Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Debugging with Trace.WriteLine

Posted on 2006-07-14
6
215 Views
Last Modified: 2008-01-09
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.
0
Comment
Question by:pallosp
  • 3
  • 2
6 Comments
 
LVL 7

Accepted Solution

by:
skvikram earned 300 total points
ID: 17110484
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
<system.web>
  <trace
    enabled="true"
    requestLimit="50"
    pageOutput="false"
    traceMode="SortByTime"
    localOnly="true" />
  </system.web>

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

0
 
LVL 9

Author Comment

by:pallosp
ID: 17114052
Tre trace messages appeared, but "Hello World!" wasn't among them. The output window is still unchanged.
0
 
LVL 2

Assisted Solution

by:tempor2001
tempor2001 earned 200 total points
ID: 17117639
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)
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 9

Author Comment

by:pallosp
ID: 17117843
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?
0
 
LVL 7

Expert Comment

by:skvikram
ID: 17120180
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.
0
 
LVL 9

Author Comment

by:pallosp
ID: 17120741
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?
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question