How to Test and Debug an ASP.NET Application—How to interpret Trace output

Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio


Jump to: navigation, search
CSharp-Online.NET:Tutorials
ASP.NET Tutorials

How Test and Debug ASP.NET

© 2006 Mike Murach & Assoc.

How to interpret Trace output

In figure 4-15, you can see the start of the output for the Cart page after the user added an item to the shopping cart. After the request details, the trace information provides a list of trace messages that are generated as the application executes. Here, ASP.NET automatically adds Begin and End messages when major page events such as PreInit, Init, and InitComplete occur. If you scroll down to see all of these trace messages, you can see the variety of events that are raised during the life cycle of a page.

After the trace messages, you’ll find information about the controls used by the page, the items in the session state object, the cookies that were included with the HTTP request, the HTTP request headers, and the server variables. In this figure, for example, you can see the session state and cookies data for the Cart page of the Shopping Cart application. In this case, an item named Cart has been added to the session state object. And a cookie named ASP.NET_SessionId is used to keep track of the user’s session ID so the user’s session state object can be retrieved.

Figure 4-15 How to enable the Trace feature and interpret Trace output

The beginning of the trace output for the Cart page

The session and cookies information for the Cart page


A Page directive that enables tracing for the Cart page

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Cart.aspx.cs"
Inherits="Cart" Trace="True" %>

Description • The ASP.NET Trace feature traces the execution of a page and displays trace information and other information at the bottom of that page.

• To activate the trace feature for a page, you add a Trace attribute to the Page directive at the top of the aspx file for the page and set its value to True as shown above.

• The trace information is divided into several tables that provide specific types of trace information. For example, the Trace Information table provides information about how the page request was processed, and the Session State table provides information about the items currently stored in session state.


Previous_Page_.gif Next_Page_.gif

Personal tools