Welcome to MSDN Blogs Sign in | Join | Help

News

  • These postings are provided "AS IS" with no warranties, and confer no rights. Use of included code samples are subject to the terms specified Terms of Use
Tip# 77: Did you know… How to enable Page Level Tracing for your ASP.NET pages?

Enabling tracing at page level gives you a bunch of information that can be useful while debugging your application.Tracing helps understand which control uses more view state,  start/end of PreInit, start/end of Init, start/end of Render, etc. This information appears at the bottom of the page. By default page level tracing is disabled.

Tracing can be enabled at Page Level and also at Application Level

To enable Tracing at Page Level select DOCUMENT in Property grid and set it’s Trace property to true as shown below.

Enable trace for a page.

This will add Trace="true" in your page directive as shown below.

<%@ Page Language="VB"  Trace="true" %>

You can also add TraceMode attribute to specify if you want the trace messages to be SortedByTime or SortByCategory.

You can now run the page and see the details as follows:

Tracing Enabled

You can enable Application level tracing in the Web.config file of your application’s root. By doing this you will get trace information for all pages in your application. In this case you can set page level tracing to false if you do not want tracing information for particular pages.

<configuration> <system.web>

<trace enabled="true" requestLimit="40" localOnly="false"/>

</system.web></configuration>

Remember to turn it off before you move your application to production. Also, know that the page level trace setting overrides the trace setting at the application level.

Enjoy Tracing!

Reshmi Mangalore

SDET, Visual Web Developer

Posted: Thursday, June 11, 2009 3:58 PM by WebDevTools

Comments

What's New said:

Enabling tracing at page level gives you a bunch of information that can be useful while debugging your

# June 12, 2009 1:11 AM

Emmanuel Bellas said:

Writing to the trace:

Trace.Write("Your message")

Viewing the trace without it displaying on your page (useful if you need to do this on a production server):

In your webconfig:

<configuration> <system.web>

<trace enabled="true" requestLimit="40" localOnly="false" pageOutput="false"/>

</system.web></configuration

# June 12, 2009 2:18 AM

Thanigainathan said:

Hi,

This is a very nice info. I will use this in my future ventures.

Thanks,

Thani

# June 12, 2009 5:33 AM

Daniele Lembo said:

&lt;div style=&quot;text-align: left;&quot;&gt;L'attivazione del &lt;b&gt;Page Level Tracing&lt;/b&gt; d&#224; un sacco di informazioni che possono essere utili durante il debug in modo da aiutare a c ...

# June 12, 2009 10:04 AM

İlhan said:

I have been using this tips since .netfx 2.0 ships. Good for tracing critical functions in the project.

# June 12, 2009 4:57 PM

DotNetShoutout said:

Thank you for submitting this cool story - Trackback from DotNetShoutout

# June 12, 2009 11:52 PM

pchamber said:

Speaking of tracing tips, advice needed re using the Session object to pass values between forms.

The "sending" statement in form 1 is

Session["PromoCode"] = promotionCodeTextBox.ToString();

The receiving statement in form 2 is

string offerCode = Session["PromoCode"] as string;

switch (offerCode) // This has a breakpoint assigned.

Using "debug", promotionCodeTextBox contains a value;

offerCode does not. Debug info about "Session" suggests a key exists, but I cannot determine its name or value.

Any suggestions?

# July 10, 2009 10:49 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

  
Enter Code Here: Required

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker