Trace Output
Now that you've heard so much about configuring ASP.NET tracing, what exactly does it provide? Essentially, the trace output generated by the TraceContext object and displayed at the bottom of your rendered ASP.NET page contains several sections. Each of these sections is outlined here, along with explanations. Because the total output is too large to be viewed in one screenshot, a screenshot is included for each individual section of the trace output. Later in the chapter, when we discuss writing messages to the trace output, you'll get a chance to see what several sections put together look like.
Request Details
The Request Details section contains six pieces of information, outlined in Table 6.2.
Table 6.2 Request Details
Item |
Description |
Session Id |
Unique identifier for your session on the server |
Time of request |
The time (accurate to the second) that the page request was made |
Request encoding |
The encoding of the requestfor example, Unicode (UTF 8) |
Request type |
GET or POST |
Status code |
The status code for the requestfor example, 200 |
Response encoding |
The encoding of the responsefor example, Unicode (UTF 8) |
You can see it all put together in Figure 6.1.
Figure 6.1 Request Details section of trace output.
Trace Information
The Trace Information section contains the various trace messages and warnings that both you and the ASP.NET engine add to the trace output. By default, the ASP.NET engine adds messages for when any events begin or end, as with PreRender and SaveViewState. The fields displayed for each item are Category, Message, time interval from the beginning of page processing, and time interval from the last trace output item. The order in which the contents of the Trace Information section appear is determined by either the TraceMode attribute of the @Page directive or the TraceMode property of the TraceContext class. Figure 6.2 shows an example of the Trace Information section.
Figure 6.2 Trace Information section of trace output.
Control Tree
The Control Tree section lists all the elements on your ASP.NET page in a hierarchical fashion. This enables you to get a feeling for which controls contain other controls, helping you to decipher control scope and ownership issues. The fields displayed for each item are Control Id, Type, Render Size Bytes, and Viewstate Size Bytes. Figure 6.3 shows an example of the Control Tree section.
Figure 6.3 Control Tree section of trace output.
Cookies Collection
The Cookies Collection section lists all the cookies that are associated with your ASP.NET web application. The fields displayed for each item are Name, Value, and Size. Figure 6.4 shows an example of the Cookies Collection section.
Figure 6.4 Cookies Collection section of trace output.
Headers Collection
The Headers Collection section lists all the HTTP headers that are passed to your ASP.NET page. The fields displayed for each item are Name and Value. Figure 6.5 shows an example of the Headers Collection section.
Figure 6.5 Headers Collection section of trace output.
Form Collection
The Form Collection section is displayed only if your ASP.NET page includes a web form and you have already submitted it back to the server. It contains two important pieces of information. First, it displays the page's VIEWSTATE. This is the condensed representation of the state of each of the controls on the web form. Below the VIEWSTATE item is a listing of each control in the Form Collection section, along with its value. The fields displayed for each item are Name and Value. Figure 6.6 shows an example of the Form Collection section.
Figure 6.6 Form Collection section of trace output.
Querystring Collection
The Querystring Collection section is displayed only if your ASP.NET page has Querystring parameters passed to it. The fields displayed for each item are Name and Value. Figure 6.7 shows an example of the Querystring Collection section.
Figure 6.7 Querystring Collection section of trace output.
Server Variables
The Server Variables section contains a listing of all the server variables associated with your ASP.NET page. A few examples are PATH_INFO, REMOTE_HOST, and SCRIPT_NAME. The fields displayed for each item are Name and Value. Figure 6.8 shows an example of the Server Variables section (truncated because of the large number of elements in the collection).
Figure 6.8 Server Variables section of trace.