Tracing is the concept or process of checking errors in code/codes. Or we can say : Tracing is a way to check the execution of your ASP.NET application. You can record exception details and program flow in a way that doesn't affect the program's output.
ASP.NET Provide Two Types of Tracing:
ASP.NET tracing can be enabled on a page-by-page basis by adding "Trace=true" to the Page directive in any ASP.NET page:
<%@ Page Language="C#" Trace="true" TraceMode = "SortByCategory" Inherits = "System.Web.UI.Page" Codevirtual="Default.aspx.cs" %>
The Page Level Tracing include some information:
- Request details (time, type, status code).
- Size (in bytes) required to render the page, and each control.
- Timing information for critical points of the page’s lifecycle.
- Cookie information sent to the server.
- Client HTTP headers.
- Form data.
- Session and application state associated with the request.
- Query strings sent with the request.
- All server variables (REMOTE_HOST, SERVER_NAME, etc).
Application level tracing by default turns on page-level tracing for all pages in the application .However ,for an individual page it is possible to explicitly turn off page tracing .Application level tracing additionally provides information about the application state, contents of the session .These static's can b collected for a specified number of request as determined by the application configuration file .Enabling application level tracing is also very simple. To enable application level tracing the following line of code needs to be added to the "System.Web" session of the "web.config" file.
trace enabled ="true" pageOutput="true"
The pageOutput parameter is required to set to be true .If the pageOutput statistics are supposed to be sent to the client (displaying as page level tracing) .By default,this value is false.
Code for Application Level tracing in web.config file
<configuration> <system.web> <trace enabled="true" requestLimit="40" pageOutput="true" localOnly="false" /> </system.web> </configuration>