DevWebProFrance News Archives About Us Feedback


Web News:

Le triple play progresse, mais pour combien de temps ?
Le taux d'adoption augmente : 8 % des consommateurs européens disposent en 2006 d'une offre intégrant l'accès haut débit, la VoIP et la TV sur ADSL, selon une étude Forrester Research. Mais l'intérêt stagne.

Sécurité IT : IBM s’empare d`Internet Security Systems
C'est la quatrième acquisition d’envergure en moins d’un mois pour Big Blue. Elle survient juste après le méga-deal avec...

1000mercis : La Camif choisit 1000mercis pour accompagner sa politique marketing online
1000mercis, pionnier de la publicité et du marketing interactifs, annonce aujourd’hui la signature d’un nouveau contrat avec la CAMIF, distributeur spécialiste de la maison et des loisirs et acteur de référence du commerce en ligne.

AOL fait le ménage dans ses équipes après la publication fortuite de données privées
Stratégie. Toujours critiquée après la mise en ligne accidentelle de données sensibles, AOL règle ses comptes en interne: sa directrice en charge des...


09.14.06


How To Use The Trace Feature In ASP.NET

By Joel Murach

This article is an excerpt from the book: Murach's ASP.NET 2.0 Web Programming with C# 2005.

The Trace feature is an ASP.NET feature that displays some useful information that you can't get by using the debugger. Because the debugger works so well, you probably won't need to use the Trace feature very much, but you should at least be aware of the information that it can provide.

How to enable the Trace feature

To use the Trace feature, you must first enable tracing. To do that, you add a Trace attribute to the Page directive for the page, and you assign a value of True to this attribute. Then, when you run the page, trace information will be displayed at the end of the page output, as shown in figure 4-15.

When you enable the Trace feature, it is enabled only for the current page, which is usually what you want. To enable tracing for another page, you must modify the Page directive for that page too. Once this feature has been enabled for a page, ASP.NET adds trace output to the page whenever the page is requested.

Wanna wallet stuffed with $10,000?
SalesGenius™.

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.

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.

About the Author:
Joel Murach has been writing and editing for more than 10 years. During that time, he sharpened his programming skills as a contract programmer in San Francisco and his instructional skills as a trainer for HarperCollins Publishing.

About DevWebProFrance
DevWebProFrance is for professional developers ... those who build and manage applications and sophisticated websites. DevWebProFrance delivers via news and expert advice New Strategies In Development.

DevWebProFrance is brought to you by:

SecurityConfig.com NetworkingFiles.com
NetworkNewz.com WebProASP.com
DatabaseProNews.com SQLProNews.com
ITcertificationNews.com SysAdminNews.com
LinuxProNews.com WirelessProNews.com
CProgrammingTrends.com NetworkNewz.com


-- DevWebProFrance is an iEntry, Inc. publication --
iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509
 © 2006 iEntry Inc.  All Rights Reserved  Privacy Policy Legal  
 

archives | advertising info | news headlines | free newsletters | comments/feedback | submit article


New Strategies In Development
DevWebProFrance Home Page About Article Archive News Downloads WebProWorld Forums Jayde iEntry Advertise Contact