The Blog of Travis Gneiting
  • Home
KEEP IN TOUCH

ASP.NET Page and Application Tracing

Apr17
2008
Written by admin

Tracing

The tracing feature in ASP.NET is useful in tracking the execution of an application. This is helpful to display the trace in a way that doesn’t affect the programs output.

To enable tracing on a page-by-page level, set the Page directive in any ASP.NET page to True:

<%@ Page Language=”C#” Trace=”true” TraceMode = “SortByCategory” Inherits = “System.Web.UI.Page” CodeFile=”Default.aspx.cs” %>

To enable tracing for an entire application add tracing settings to the web.config:

<configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<compilation debug=”false” />
<authentication mode=”Windows” />
<trace enabled =”true” pageOutput =”True” requestLimit =”20″ traceMode =”SortByTime ” />
</system.web>
</configuration>

The page-level setting will take precedence over the web.config setting.

How to view Trace Data.

In the Page_Load event call System.Diagnostics.Trace.Write(). Make sure the pageOutput=True in the webConfig.

What’s being displayed

1. Request Details
ASP.NET Session ID, Character encoding of the request.

2. Trace information
All Trace.write methods called in the HTTP request. This is helpful to find methods that are taking a long time to execute.

3. Control Tree

HTML of ASP.NET Control Tree.

4. Session State
List all keys and values for users session .

5. Application State
List all keys and values for application.

6. Request Cookies Collection
List all cookies passed in during page request.

7. Response Cookies Collection
List all cookies passed back during page response.

8. Headers Collection
Shows all headers passed in during request from browser.

9. Response Headers Collection
Shows all headers passed back during response.

10. Form Collection
Displays dump of Form Collection and all keys and values.

11. Querystring Collection
Displays dump of Querystring collection and all keys and values.

12. Server Variables
Displays dump of Server Variables with keys and values.

The Trace.axd
Page output only displays information of the current page. If you want to create a collection use Trace.axd.

http://localhost/application-name/trace.axd

Trace.axd will display all tracing data up to the present limit.

Trace Forwarding

ASP.NET allows to forward trace message to System.Diagnostics.Trace:write to DiagnosticsTrace

<trace enabled =”true” requestLimit =”20″ writeToDiagnosticsTrace =”true ” pageOutput =”true”/>

Posted in Debugging - Tagged Trace Debug ASP.NET
SHARE THIS Twitter Facebook Delicious StumbleUpon E-mail
« Zend Framework Quickstart
» Agile Software Development

Programming

  • ASP.NET
  • MSDN
  • Visual Studio Offical Website
  • www.w3.org

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org

Welcome to My Programming Blog

This is my brain dump. I use it to post thing I may use again, interesting things I have run into and programming helps.

Tags

.net Agile Software Development Engineering ASP.NET attack Beginner Blueprint CSS Database Deployment DevExpress Framework Functional hacked Hotmail How to test software HTTP IIS Javascript JQuery MIME New Website Checklist PHP querystring Software Testing Specification spoof Status Codes Testing Trace Debug ASP.NET Tutorial Velocity webmethod Website Testing Zend

Blog Archive

  • January 2012
  • November 2011
  • August 2011
  • July 2011
  • June 2011
  • May 2011
  • February 2011
  • January 2011
  • November 2010
  • October 2010
  • August 2010
  • July 2010
  • May 2010
  • April 2010
  • March 2010
  • February 2010
  • February 2009
  • January 2009
  • November 2008
  • September 2008
  • August 2008
  • July 2008
  • April 2008

EvoLve theme by Theme4Press  •  Powered by WordPress The Blog of Travis Gneiting