1

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?

jay_t55
  • 11,362
  • 28
  • 103
  • 174
  • I think you can enable to console for debugging purposes – dtsg Aug 09 '12 at 10:28
  • If you want to do logging, it would probably be much better to use a properly configurable logging framework. We use NLOG, so I'm going to recommend that. See http://nlog-project.org/ – Matthew Watson Aug 09 '12 at 10:36
  • duplicate http://stackoverflow.com/questions/137660/where-does-console-writeline-go-in-asp-net – Ankush Aug 09 '12 at 10:42

1 Answers1

2

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 window

To open the Output window, on the View menu, click Output.

You may want to see: Where does Console.WriteLine go in ASP.NET?

Community
  • 1
  • 1
Habib
  • 219,104
  • 29
  • 407
  • 436