Tracing in ASP.NET application (trace.axd)

You can enable tracing for an entire application in the Web.config file in the application’s root directory. By default, application-level tracing can be viewed only when accessing the website from the webserver browser; and that’s a good thing, you don’t want anyone be able to see your application’s trace!

  1. First thing to do is to enable tracing for the application by defining it in the Web.config file in the application’s root directory, like below:
  2. <configuration>
    		<trace enabled="true" requestLimit="40" localOnly="false" />

    The trace options are:

    • enabled
    • true if tracing is enabled for the application; otherwise, false. The default is false.

    • pageOutput
    • true if trace information is displayed both on an application’s pages and in the .axd trace utility; otherwise, false. The default is false.
      Pages that have tracing enabled are not affected by this setting.

    • requestLimit
    • Number of trace requests to store on the server. The default is 10.

    • traceMode
    • Indicates whether trace information is displayed in the order in which it was processed (SortByTime) or alphabetically by user-defined category (SortByCategory). The default is SortByTime.

    • localOnly
    • true if the trace viewer (Trace.axd) is available only on the host Web server; otherwise, false. The default is true.

  3. Then browse the application and add ‘/trace.axd’ to the end of the URL
  4. For example, if the URL of the application is ‘http://localhost/Application’, the URL to trace will be ‘http://localhost/Application/trace.axd’

  5. Clear the current results that will be displayed.
  6. Refresh the trace page.

Or enable the trace directly in a specific page:

<%@ Page Language="VB" Trace="true" requestLimit="40" localOnly="false" %>

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top