Export (0) Print
Expand All

ASP.NET Trace

ASP.NET introduces new functionality that allows you to view diagnostic information about a single request for an ASP.NET page simply by enabling it for your page or application. Called tracing, this feature also allows you to write debug statements directly in your code without having to remove them from your application when it is deployed to production servers. You can write variables or structures in a page, assert whether a condition is met, or simply trace through the execution path of your page or application.

In order for these messages and other tracing information to be gathered and displayed, you must enable tracing for the page or application. When you enable tracing, two things occur:

  • ASP.NET appends a series of diagnostic information tables immediately following the page's output. The information is also sent to a trace viewer application (if you have enabled tracing for the application).
  • ASP.NET displays your custom diagnostic messages in the Trace Information table of the appended performance data.

Diagnostic information and tracing messages that you specify are appended to the output of the page that is sent to the requesting browser. Optionally, you can view this information from a separate trace viewer (Trace.axd) that displays trace information for every page in a given application. This information can help you to clarify errors or undesired results as ASP.NET processes a page request.

Trace statements are processed and displayed only when tracing is enabled. You can control whether tracing is displayed to a page, to the trace viewer, or both.

In This Section

Enabling Tracing for a Page
Explains how to enable tracing for a page, include trace statements in page output, and interpret trace messages.
Writing Trace Messages
Describes how to use the TraceContext.Write and TraceContext.Warn methods to write statements to the trace log.
Enabling Application-Level Tracing
Details how you can enable tracing for an entire application through the ASP.NET configuration system. It also describes how to use the trace viewer, an HTTP module that you can access from your Web browser.
Reading Trace Information
Details the information available to you when you view trace information that is added to the page or to the trace viewer.

Related Sections

Creating ASP.NET Web Applications
Introduces the features of ASP.NET and outlines what you can accomplish by programming with them.
TraceContext Class
Captures and presents execution details about a Web request.
Show:
© 2014 Microsoft