ASP.NET
  Home arrow ASP.NET arrow Page 2 - Advanced Testing and Debugging of an ASP.N...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP.NET

Advanced Testing and Debugging of an ASP.NET 2.0 Application
By: Murach Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 3
    2006-05-25

    Table of Contents:
  • Advanced Testing and Debugging of an ASP.NET 2.0 Application
  • How to use the Trace feature
  • How to create custom trace messages
  • How to write information directly to the HTTP output stream

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Advanced Testing and Debugging of an ASP.NET 2.0 Application - How to use the Trace feature


    (Page 2 of 4 )


     
    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.

    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


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

    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

    1. The ASP.NET Trace feature traces the execution of a page and displays trace information and other information at the bottom of that page.
    2. 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.
    3. 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.

    More ASP.NET Articles
    More By Murach Publishing


       · This article is an excerpt from the book "Murach's ASP.NET 2.0 Web Programming with...
     

    Buy this book now. This article is excerpted from chapter four of the book Murach's ASP.NET 2.0 Web Programming with VB 2005, written by Joel Murach and Anne Boehm (Murach, 2006; ISBN: 1-890774-32-4). Check it out today at your favorite bookstore. Buy this book now.

    ASP.NET ARTICLES

    - Developing a Mini ASP.NET AJAX Server Centri...
    - Disadvantages of the ASP.NET MVC Framework
    - Advantages of the ASP.NET MVC Approach
    - ASP.NET Web Forms Weaknesses
    - ASP.NET Web Forms Meets ASP.NET MVC
    - Source Code for Saving and Retrieving Data w...
    - Using GridView to Save and Retrieve Data wit...
    - Handling Dynamic Images in ASP.NET 3.5 AJAX ...
    - Retrieving Data with AJAX and the GridView C...
    - Playing with Images in ASP.NET 3.5 AJAX Appl...
    - Saving and Retrieving Data with AJAX
    - Enhancing PHP Via the ASP.NET AJAX Framework...
    - Enhancing PHP Programming with the ASP.NET A...
    - Classes and ASP.NET AJAX
    - Using ASP.NET AJAX

     
    Best Practices for Windows Vista Migration Presentation
    Dell and Microsoft recently held a series of face-to-face seminars entitled, &qu....

     
    Creating a Culture for Code Reuse
    If you oversee development teams you know that like it or not proprietary and ex....

     
    Keys to Web Application Acceleration: Advances in Delivery Systems
    Accelerate Web apps by up to 5x. Ensure significantly faster access to the Web a....

     
    Optimizing Application Monitoring
    Tired of finding out from your customers that you're offline? This white paper e....

     
    Solaris to Solaris Migration -- Migrating applications from Sun SPARC to Dell PowerEdge R900
    This comprehensive Migration Guide reviews the approach that Principled Technolo....

     




    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
    Stay green...Green IT