I’ve seen it in many code samples, tutorials and other people’s code that I’ve worked with. I’ve never really understood (or even learned) why people use Console.Write(exception.Message);.
The only reason I can think of is to log the exception for later investigation. So, I thought I’d give it a try, since I have some spare time on my hands, and have tried to find some specific info regarding my questions, but couldn’t find it.
If I use Console.Write(exception.Message); in an asp.net webpage, where exactly does this go? Where is the “Console” in a web app/site?
And, how do you “see” what you’ve previously written to the Console?
In Visual studio, for winforms and WPF application it prints to Output window
For ASP.Net use
System.Diagnostics.Debug.WriteLine()to print to output windowYou may want to see: Where does Console.WriteLine go in ASP.NET?