Login or Sign Up to become a member!

EXPERTS, INFORMATION, IDEAS & KNOWLEDGE

Social bookmarker Add this

ASP.NET: Enabling page tracing

From Wiki

Jump to: navigation, search


Summary: Enabling page tracing

Page tracing allows you to look at a series of tables containing execution details about the ASP.NET page request. To turn it on for an individual page, add it to your Page directive e.g.

  1. <%@ Page Trace="true" %>

You can also add it at a site wide level via the web.config file e.g.

  1. <trace
  2.    enabled="false"
  3.    localOnly="true"
  4.    mostRecent="false"
  5.    pageOutput="false"
  6.    requestLimit="10"
  7.    traceMode="SortByTime"
  8.    writeToDiagnosticsTrace="false"
  9. />

This next collection of tables shows an example output of page tracing with each section seperated in different code blocks (for easier reading):


Contents

Request Details

  1. Session Id: ooj01b55jsm3pbrsuzndjny4    Request Type:   GET
  2. Time of Request:    30/06/2008 21:12:10 Status Code:    200
  3. Request Encoding:   Unicode (UTF-8) Response Encoding:  Unicode (UTF-8)
  4. '''Trace Information'''
  5. Category    Message From First(s)   From Last(s)
  6. aspx.page   Begin PreInit      
  7. aspx.page   End PreInit 0.0414658175793025  0.041466
  8. aspx.page   Begin Init  0.0416244774719023  0.000159
  9. aspx.page   End Init    0.0419913760405645  0.000367
  10. aspx.page   Begin InitComplete  0.0420056954065438  0.000014
  11. aspx.page   End InitComplete    0.0420163705507756  0.000011
  12. aspx.page   Begin PreLoad   0.0420260335775458  0.000010
  13. aspx.page   End PreLoad 0.0420388647116364  0.000013
  14. aspx.page   Begin Load  0.0420485696604316  0.000010
  15. aspx.page   End Load    0.0427454364881321  0.000697
  16. aspx.page   Begin LoadComplete  0.0427603038348671  0.000015
  17. aspx.page   End LoadComplete    0.0427708262631505  0.000011
  18. aspx.page   Begin PreRender 0.0427806839278941  0.000010
  19. aspx.page   End PreRender   0.0451939911764119  0.002413
  20. aspx.page   Begin PreRenderComplete 0.0452132273970415  0.000019
  21. aspx.page   End PreRenderComplete   0.0452240792126644  0.000011
  22. aspx.page   Begin SaveState 0.0625720689517497  0.017348
  23. aspx.page   End SaveState   0.0720684586668796  0.009496
  24. aspx.page   Begin SaveStateComplete 0.0720922673826682  0.000024
  25. aspx.page   End SaveStateComplete   0.0721030922484179  0.000011
  26. aspx.page   Begin Render    0.0721127432974667  0.000010
  27. aspx.page   End Render  0.0926866508294572  0.020574

NOTE: You can also add custom information to this section of the Trace. Try adding a Trace.Warn("") statement in your code and when that line is executed it will write the text out to the page in Red. This can be very useful for checking execution times of various functions you write.


Control Tree

  1. Control UniqueID    Type    Render Size Bytes (including children)  ViewState Size Bytes (excluding children)   ControlState Size Bytes (excluding children)
  2. __Page  ASP.default_aspx    16551   0   0
  3.     ctl00   ASP.masterpage_master   16551   0   0
  4.         ctl00$ctl08 System.Web.UI.LiteralControl    182 0   0
  5.         ctl00$ctl00 System.Web.UI.HtmlControls.HtmlHead 638 0   0
  6.             ctl00$ctl01 System.Web.UI.HtmlControls.HtmlMeta 43  0   0
  7.             ctl00$ctl02 System.Web.UI.HtmlControls.HtmlMeta 51  0   0
  8.             ctl00$ctl03 System.Web.UI.HtmlControls.HtmlMeta 67  0   0
  9.             ctl00$ctl04 System.Web.UI.HtmlControls.HtmlMeta 66  0   0
  10.             ctl00$ctl05 System.Web.UI.HtmlControls.HtmlMeta 69  0   0
  11.             ctl00$ctl06 System.Web.UI.HtmlControls.HtmlMeta 51  0   0
  12.             ctl00$stMainLayout  System.Web.UI.HtmlControls.HtmlLink 114 0   0
  13.             ctl00$stMDSSolutions    System.Web.UI.HtmlControls.HtmlLink 118 0   0
  14.             ctl00$ctl07 System.Web.UI.HtmlControls.HtmlTitle    46  0   0
  15.         ctl00$ctl09 System.Web.UI.ResourceBasedLiteralControl   2492    0   0
  16.         aspnetForm  System.Web.UI.HtmlControls.HtmlForm 12509   0   0
  17.             ctl00$ctl10 System.Web.UI.LiteralControl    22  0   0
  18.             ctl00$ContentPlaceHolder1   System.Web.UI.WebControls.ContentPlaceHolder    11249   0   0
  19.                 ctl00$ContentPlaceHolder1$chkSilverBlog System.Web.UI.WebControls.CheckBox  117 0   0
  20.                 ctl00$ContentPlaceHolder1$chkGoldBlog   System.Web.UI.WebControls.CheckBox  113 0   0
  21.                 ctl00$ContentPlaceHolder1$chkSilverForum    System.Web.UI.WebControls.CheckBox  119 0   0
  22.                 ctl00$ContentPlaceHolder1$chkGoldForum  System.Web.UI.WebControls.CheckBox  115 0   0
  23.                 ctl00$ContentPlaceHolder1$chkSilverGallery  System.Web.UI.WebControls.CheckBox  123 0   0
  24.                 ctl00$ContentPlaceHolder1$chkGoldGallery    System.Web.UI.WebControls.CheckBox  119 0   0
  25.                 ctl00$ContentPlaceHolder1$chkSilverShop System.Web.UI.WebControls.CheckBox  117 0   0
  26.                 ctl00$ContentPlaceHolder1$chkGoldShop   System.Web.UI.WebControls.CheckBox  113 0   0
  27.                 ctl00$ContentPlaceHolder1$lblSale   System.Web.UI.WebControls.Label 119 72  0
  28.                 ctl00$ContentPlaceHolder1$btnBronze System.Web.UI.WebControls.ImageButton   187 0   0
  29.                 ctl00$ContentPlaceHolder1$btnSilver System.Web.UI.WebControls.ImageButton   187 0   0
  30.                 ctl00$ContentPlaceHolder1$btnGold   System.Web.UI.WebControls.ImageButton   181 0   0
  31.                 ctl00$ContentPlaceHolder1$btnPlatinum   System.Web.UI.WebControls.ImageButton   193 0   0
  32.             ctl00$ctl11 System.Web.UI.LiteralControl    18  0   0
  33.         ctl00$ctl12 System.Web.UI.LiteralControl    18  0   0
  34.         ctl00$litUnderForm  System.Web.UI.WebControls.Literal   0   0   0
  35.         ctl00$ctl13 System.Web.UI.ResourceBasedLiteralControl   712 0   0


Session State

  1. Session Key Type    Value


Application State

  1. Application Key Type    Value
  2. '''Request Cookies Collection'''
  3. Name    Value   Size
  4. ReturnURL   /epregister/secure/incident/incidentmap.aspx    54
  5. ASP.NET_SessionId   ooj01b55jsm3pbrsuzndjny4    42
  6. .eprsec F1E78DF9DC6C439D026B006500690074006800000088BC8780C8D9C8010088F069B1CCD9C80100002F000000    96


Response Cookies Collection

  1. Name    Value   Size


Headers Collection

  1. Name    Value
  2. Connection  keep-alive
  3. Keep-Alive  300
  4. Accept  text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  5. Accept-Charset  ISO-8859-1,utf-8;q=0.7,*;q=0.7
  6. Accept-Encoding gzip,deflate
  7. Accept-Language en-gb,en;q=0.5
  8. Cookie  ReturnURL=/epregister/secure/incident/incidentmap.aspx; ASP.NET_SessionId=ooj01b55jsm3pbrsuzndjny4; .eprsec=F1E78DF9DC6C439D026B006500690074006800000088BC8780C8D9C8010088F069B1CCD9C80100002F000000
  9. Host    localhost:2955
  10. User-Agent  Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9) Gecko/2008052906 Firefox/3.0
  11. Response Headers Collection
  12. Name    Value
  13. X-AspNet-Version    2.0.50727
  14. Cache-Control   public, max-age=3600
  15. Expires Mon, 30 Jun 2008 21:12:10 GMT
  16. Last-Modified   Mon, 30 Jun 2008 20:12:10 GMT
  17. Content-Type    text/html


Form Collection

  1. Name    Value


Querystring Collection

  1. Name    Value


Server Variables

  1. Name    Value
  2. ALL_HTTP    HTTP_CONNECTION:keep-alive HTTP_KEEP_ALIVE:300 HTTP_ACCEPT:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 HTTP_ACCEPT_CHARSET:ISO-8859-1,utf-8;q=0.7,*;q=0.7 HTTP_ACCEPT_ENCODING:gzip,deflate HTTP_ACCEPT_LANGUAGE:en-gb,en;q=0.5 HTTP_COOKIE:ReturnURL=/epregister/secure/incident/incidentmap.aspx; ASP.NET_SessionId=ooj01b55jsm3pbrsuzndjny4; .eprsec=F1E78DF9DC6C439D026B006500690074006800000088BC8780C8D9C8010088F069B1CCD9C80100002F000000 HTTP_HOST:localhost:2955 HTTP_USER_AGENT:Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9) Gecko/2008052906 Firefox/3.0
  3. ALL_RAW Connection: keep-alive Keep-Alive: 300 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Accept-Encoding: gzip,deflate Accept-Language: en-gb,en;q=0.5 Cookie: ReturnURL=/epregister/secure/incident/incidentmap.aspx; ASP.NET_SessionId=ooj01b55jsm3pbrsuzndjny4; .eprsec=F1E78DF9DC6C439D026B006500690074006800000088BC8780C8D9C8010088F069B1CCD9C80100002F000000 Host: localhost:2955 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9) Gecko/2008052906 Firefox/3.0
  4. APPL_MD_PATH     
  5. APPL_PHYSICAL_PATH  C:\Documents and Settings\Mark Smith\My Documents\Visual Studio 2005\WebSites\MDSSolutions\
  6. AUTH_TYPE   NTLM
  7. AUTH_USER   MAIN\Mark Smith
  8. AUTH_PASSWORD   
  9. LOGON_USER  MAIN\Mark Smith
  10. REMOTE_USER MAIN\Mark Smith
  11. CERT_COOKIE 
  12. CERT_FLAGS   
  13. CERT_ISSUER 
  14. CERT_KEYSIZE     
  15. CERT_SECRETKEYSIZE   
  16. CERT_SERIALNUMBER   
  17. CERT_SERVER_ISSUER   
  18. CERT_SERVER_SUBJECT 
  19. CERT_SUBJECT     
  20. CONTENT_LENGTH  0
  21. CONTENT_TYPE     
  22. GATEWAY_INTERFACE   
  23. HTTPS   
  24. HTTPS_KEYSIZE   
  25. HTTPS_SECRETKEYSIZE 
  26. HTTPS_SERVER_ISSUER 
  27. HTTPS_SERVER_SUBJECT     
  28. INSTANCE_ID 
  29. INSTANCE_META_PATH   
  30. LOCAL_ADDR  127.0.0.1
  31. PATH_INFO   /MDSSolutions/Default.aspx
  32. PATH_TRANSLATED C:\Documents and Settings\Mark Smith\My Documents\Visual Studio 2005\WebSites\MDSSolutions\Default.aspx
  33. QUERY_STRING     
  34. REMOTE_ADDR 127.0.0.1
  35. REMOTE_HOST 127.0.0.1
  36. REMOTE_PORT 
  37. REQUEST_METHOD  GET
  38. SCRIPT_NAME /MDSSolutions/Default.aspx
  39. SERVER_NAME localhost
  40. SERVER_PORT 2955
  41. SERVER_PORT_SECURE  0
  42. SERVER_PROTOCOL HTTP/1.1
  43. SERVER_SOFTWARE 
  44. URL /MDSSolutions/Default.aspx
  45. HTTP_CONNECTION keep-alive
  46. HTTP_KEEP_ALIVE 300
  47. HTTP_ACCEPT text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  48. HTTP_ACCEPT_CHARSET ISO-8859-1,utf-8;q=0.7,*;q=0.7
  49. HTTP_ACCEPT_ENCODING    gzip,deflate
  50. HTTP_ACCEPT_LANGUAGE    en-gb,en;q=0.5
  51. HTTP_COOKIE ReturnURL=/epregister/secure/incident/incidentmap.aspx; ASP.NET_SessionId=ooj01b55jsm3pbrsuzndjny4; .eprsec=F1E78DF9DC6C439D026B006500690074006800000088BC8780C8D9C8010088F069B1CCD9C80100002F000000
  52. HTTP_HOST   localhost:2955
  53. HTTP_USER_AGENT Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9) Gecko/2008052906 Firefox/3.0
  54. Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433


This Hack is part of the ASP.NET Hacks collection

478 Rating: 5.0/5 (2 votes cast)