Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use console output in an ASP.NET environment?

I would like to print some traces during the requests processing.

But when I make Console.WriteLine("something") in this environment, nothing is shown.

What is missing, what do I need to do in order to use console to print these traces?

like image 661
Victor Rodrigues Avatar asked Dec 04 '09 17:12

Victor Rodrigues


People also ask

How do I show console output in Visual Studio?

Press F11 . Visual Studio calls the Console. WriteLine(String, Object, Object) method. The console window displays the formatted string.

How do I show console WriteLine output in my browser console?

You can use Debug. Writeline("debug information") . It will be displayed in the Output window.

How do I use console in Visual Studio?

Open Visual Studio, and choose Create a new project in the Start window. In the Create a new project window, select All languages, and then choose C# from the dropdown list. Choose Windows from the All platforms list, and choose Console from the All project types list.

How do you write a console message in C#?

In C# you can write or print to console using Console. WriteLine() or Console. Write(), basically both methods are used to print output of console.


1 Answers

Use Debug.Write() and and watch the results come out through the debugger output window in the IDE.

Alternatively, use the ASP.NET trace feature, which is quite powerful. Once you have enabled tracing, you can navigate to the trace.axd page in your web app's root directory. This page will show the trace messages for your app.

like image 96
CesarGon Avatar answered Sep 27 '22 21:09

CesarGon