My thoughts regarding ASP.NET, C#, programming practices, and more...
reading
You Should Read archives
blogs I read
|
Sunday, October 10, 2004Keeping a C# Console Application Command Window Open
I am writing a small app to help me debug a problem with System.Web.Mail on different web servers. The app attempts to send an e-mail using SmtpMail class and specifying the SmtpServer property. If there are any errors they get written to console.
Content copyright ©2003-2006 Tod Birdsall
Everything is working great, however I would like to be able to double click the created .EXE file and have the command window remain open after the mail has been sent and any errors have been written out. You can do this by opening a command window and executing the app from there. Solution: If you add the line "Console.ReadLine();" to the end of the "Main" method, the window stays open until you push the Enter key. |