Debugging with Trace.WriteLine

I'd like to debug a web page using Debug.WriteLine or Trace.WriteLine. Where do they output to? What should be added to web.config and the .aspx file? How should Visual Studio 2005 be configured?

My Default.aspx.cs is now

    protected void Page_Load(object sender, EventArgs e)
        System.Diagnostics.Trace.Write("Hello World!");
        System.Diagnostics.Debug.Write("Hello World!");

After running Default.aspx on the integrated web server nothing is seen in the Output window except the build info.
Who is Participating?
To enable tracing for the single page
<%@ Page Trace="True" %>

It will show the trace message in browser window. within lots of other trace messages.

To enable application level tracing add the following in Web.config
    localOnly="true" />

To enable application level Debugging add the following in Web.config
  <compilation debug="true" />

pallospAuthor Commented:
Tre trace messages appeared, but "Hello World!" wasn't among them. The output window is still unchanged.
no need to write
System.Diagnostics.Trace.Write("Hello World!");
just use
Trace.Write ("Hello World!");
(plus enable tracing as it described skvikram in previous post)
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

pallospAuthor Commented:
OK, I can see the text under the web page, but still nothing appears in the Output window. Setting pageOutput="true" doesn't help. Which Trace class is integrated with Visual Studio?
Setting pageOutput="true" doesn't help >> Setting pageOutput="true" appends trace messages to each page of aplication

Tracing is essentially a mechanism to monitor the performance of an Application.

Application-level tracing can be performed by enabling the same in web.config or machine.config file. A special page Trace.Axd is used to view trace information collected from all the pages in the application.

ASP.NET application executes in a seperate process aspnet_wp.exe . Perfmon tool can be used to monitor the performance of application.
pallospAuthor Commented:
Do I think well that VS integrated trace/debug output is only supported by simple C# projects, and in ASP.NET projects I have to be satisfied with Trace.axd?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.