How to get the ASP.NET trace information?

Posted by Unknown


How to get the ASP.NET trace information?
in this blog am going explain about how get the trace information in asp.net


in the asp.net we can get  the trace information in application level and the page level,
lets have look on web site level

application  level:
With the tracing enabled, you can view the trace output in a trace viewer by navigation to trace.axd from the root of your application. For example, if the URL of your application is http://localhost:11423/Website, then the trace viewer can be accessed at http://localhost:11423/WebSite1/trace.axd.
Trace
You can click on the “View Details” link of a requested page to see further information about that specific page.
To write to the trace output, you can add the statment Trace.Write(“This is an action in my page.”) into your code.
The trace request limit and whether the most recent tracing data is kept and shown in the viewer can be specified in the web.config file as follows:
<system.web>
    <trace enabled=”true” mostRecent=”true” pageOutput=”true” requestLimit=”20” />

Page Level:
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 orSortByCategory.

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


i hope this will helps you in debug and tracing

Labels: ,

Post a Comment

 
test