SIGN UP MEMBER LOGIN:    
ARTICLE

Tracing in .Net 2.0

Posted by Bhawna Articles | ASP.NET Programming May 12, 2011
Tracing is a new feature given in .Net 2.0 that helps the user to view different steps occurred while execution of a single ASP.net Page at run time
Reader Level:


Tracing is a new feature in .Net 2.0 that helps the user to view the different steps that have occurred in execution of a single ASP.Net Page at run time. Tracing information helps you to investigate errors or unwanted results when ASP.Net processes a page request.

By default, tracing is disabled so if you want to view the tracing information you have to enable the tracing.

Tracing can be one of two types Page Level Tracing and Application Level Tracing.

Page Level Tracing:

Gives information about a particular page.

To enable the page level tracing Add "Trace=true" in the Page directive of an ASP.Net Page:

<%@ Page Trace="true" %>

Another attribute that you can use here is TraceMode.

Set TraceMode to SortByTime to sort the information in the order of execution.

Set TraceMode to SortByCategory to sort the information by categories.

<%@ Page Language="VB" Trace="True" TraceMode="SortByCategory" %>

Application Level Tracing:

Gives information about the whole application.

Application level tracing can be enabled in the web.config file by using the trace element inside the system.web tag.

<configuration>
<system.web>
<trace enabled="true" />
</system.web>
</configuration>

Other elements that can be used are:

pageOutput-> Set this element to true if you want to display trace information at the end of the page; set this element to false if you want to display trace information in TraceViewer.

requestLimit-> A number that indicates for how many requests trace information is required.

Note: A Trace attribute in a Page directive overrides the trace attribute in web.config file.

How to view trace information with trace viewer

To do this, tracing should be enabled in the web.config file.

  1. Navigate to trace.axd in the root of your application.

    For example, if the URL for your application is http://localhost/SampleApplication, navigate to http://localhost/SampleApplication/trace.axd to view the trace information for that application.
     
  2. Select the View Details link for the request that you want to investigate.

    Tracking1.gif

Disadvantages of using Tracing

Tracing displays sensitive information, such as values of server variables, and can therefore cause security vulnerabilities. So be sure to disable the tracing before deploying your application to a production server.

Login to add your contents and source code to this article
share this article :
post comment
 

Welcome to the Mindcracker Community.

Posted by Dinesh Beniwal May 12, 2011
Nevron Gauge for SharePoint
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
Become a Sponsor