Click here to Skip to main content
14,638,468 members
Articles » Web Development » Wiki.ASP.NET articles » General
Posted 11 Oct 2013


2 bookmarked

Tracing for an application

Rate this:
0.00 (No votes)
Please Sign up or sign in to vote.
0.00 (No votes)
11 Oct 2013CPOL offers a built-in functionality for tracing theapplication. Using this functionality one can view a lot ofdiagnostic

This articles was originally at but has now been given a new home on CodeProject. Editing rights for this article has been set at Bronze or above, so please go in and edit and update this article to keep it fresh and relevant. offers a built-in functionality for tracing the application. Using this functionality one can view a lot of diagnostic information which is rendered as the page output when the tracing is enabled. This tracing information can also be viewed using Trace Viewer. Tracing is output in a tabular format on the page and in the trace viewer too.

As many other features, tracing can be enabled at the page level as well as at the application level.

To enable tracing at the Page level, include Trace=”true” attribute in the @Page directive, for the page you want tracing to be enabled.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TestTracing._Default"


Run your application, and you'll see the Tracing information on the page where tracing has been made enabled. This information is always showed at the bottom of the page after all the page controls are done with rendering. So, if you have nothing on the page, the page will be showing only the Tracing information.

To enable tracing at the Application level, add a trace element as a child to the system.web element and set its 'enabled' attribute to 'true'.


<trace enabled="true" pageOutput="true" requestLimit="10"/>


The other attributes include;

pageOutput; which lets you choose whether to output the tracing information in the page too or only in the trace viewer. requestLimit; number of trace requests to store on the server. Default value is 10 for this attribute.

To use Trace Viewer for viewing Tracing information, just navigate to “Trace.axd” in your application. Its in the root and you can navigate to it by entering URL like this “http://localhost/MyApplication/Trace.axd”

Tracing information includes; Request Details, Trace Information, Control Tree, Session Collection, Cookies Collection, Forms Collection, Headers Collection, Server Variables.



This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

ASP.NET Community
United States United States
The ASP.NET Wiki was started by Scott Hanselman in February of 2008. The idea is that folks spend a lot of time trolling the blogs, googlinglive-searching for answers to common "How To" questions. There's piles of fantastic community-created and MSFT-created content out there, but if it's not found by a search engine and the right combination of keywords, it's often lost.

The ASP.NET Wiki articles moved to CodeProject in October 2013 and will live on, loved, protected and updated by the community.
Group type: Collaborative Group

758 members

Comments and Discussions

-- There are no messages in this forum --