banner Hi, this is Shiva Kumar. You can call me Shiva. I'm a developer like you, with 7 Years of experience on different technologies. Earlier I used to write articles for Computers Today. Now I started this web site to help each other ( or ) atleast contribute some thing from my end. I'm always a student, if you need any articles or help which is not there in this web site, please send me a mail. I will update you as soon as I can.
Jul
6th

How to Enabe Tracing for the Page Level and Application Level in ASP.net

Author: admin | Files under Asp.net, tutorials

Introduction

Tracing is the new functionality added to the Asp.net. It allows you to view Diagnostic Information about a single request for an ASP.NET page, simply by enabling it for your page or application level.

Other smart thing about tracing is, they are automatically removed from the application when it is deployed to production servers. The trace information can be viewed in two ways:

  • One way is, ASP.NET appends the trace information at the end of the Page
  • Other is, saved to the application’s trace.axd file

In this tutorial I will show how to enable the tracing at page level and application level in the following sections as follows:

  • Enable the tracing at Page Level using the Page Directives
  • Enable the tracing at Application Level using the Configuration Option

Enable the tracing at page level using the Page Directives

Page directives are very useful, these are instructions that ASP.NET uses when processing a request for an ASP.NET resource. They can also be used to override or apply configuration settings for an ASP.NET page. Note that, Page directives must be the first element on a page.

We can add the page directives using the <%@  %>. as follows:

  1. <%@ Page Trace="true" %>

Enable the Tracing at Application Level using the Configuration Option ( config.web )

ASP.NET uses XML configuration file called config.web to set configuration settings for ASP.NET applications. Configuration file sets the default ASP.NET configuration, and in Beta 1 is known as the root configuration file. Changes made within this file affect all of our ASP.NET Web application.

To add application level tracing, first open the config.web file and find the <trace> as follows:

  1.  
  2. <configuration>
  3. <trace
  4. enabled="true"
  5. requestlimit="10"
  6. pageoutput="true"
  7. tracemode="SortByTime"
  8. />
  9. </configuration>
  10.  

Enabled argument enables the tracing by setting its value as true. The other interesting option is, we can sort the trace output by time and Category by setting the pageoutput argument to SortByTime and SortByCategory respectively.

References:

http://msdn.microsoft.com/en-us/library/ms972204.aspx

Similar Posts - 90% of Users have seen these posts also

Post a Comment