Printing ASP.NET Debugging Output

For ASP.NET development, I use Microsoft’s Visual Studio (IDE). In any development environment, I regularly use print statements to discover and verify my programming’s actual functionality. In Java, simply printing to the console (with System.out.println) achieves this aim, but with ASP.NET and Visual Studio I tried the same approach (using Console.WriteLine) to no avail.

After some searching, I discovered that one must use the .NET System.Diagnostics namespace to print statements that programmers can use to troubleshoot development problems. Below is an example of such a print statement.

String testString = "Hello World";
System.Diagnostics.Debug.WriteLine(testString);

Here’s what the output looks like in Visual Studio 2017

Visual Studio IDE Debug Output.
Visual Studio Debugging Output

Leave a Reply

Your email address will not be published. Required fields are marked *