O'Reilly logo

Learning ASP.NET 2.0 with AJAX by Dan Hurwitz, Jesse Liberty, Brian MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Tracing

Tracing is the technique of reporting the value or state of things in your program, as it runs. It is an easy way to determine what is going on in your program. Back in the days of classic ASP, the only way to trace what was happening in your code was to insert Response.Write statements in strategic places. This allowed you to see that you had reached a known point in the code and, perhaps, to display the value of some variables. The big problem with this hand-tracing technique, aside from the amount of work involved, was that you had to laboriously remove or comment out all those statements before the program went into production. ASP.NET provides better and easier ways of gathering the trace information.

Here's DebuggingApp in action. After you select a book title from the DropDownList, its title and ISBN are output in the Label.

Figure 8-2. Here's DebuggingApp in action. After you select a book title from the DropDownList, its title and ISBN are output in the Label.

Page-Level Tracing

To add page-level tracing, modify the Page directive at the top of the .aspx page (in Source view) by adding a Trace attribute and setting its value to true, as follows (remember to close the browser first):

	<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb"
	       Inherits="_Default" Trace="true" %>

When you view this page, tables will be appended to the bottom of the page that contain a wealth of information about your web application. Select a book from the drop-down list and you will see something like ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required