Requirement:
You want to identify or debug web traffic flow to your web pages through various network path involves in connection to your web server. As part of this, you’d like to get all of the HTTP headers that are reaching your webpage. Using aspx you can very easily fetch the complete HTTP headers, Server variables and a lot of additional debug details just with a single aspx page directive. In .aspx, you can use HTML directive Trace=”true” at the beginning of the page as shown below.
A simple .aspx page to display all of HTTP Headers and Server Variables:
- Create a simple .aspx page with <%@ Page Trace=”true” %> text as shown below:
- Request Details
- Trace Information
- Control Tree
- Session State
- Application State
- Request Cookies Collection
- Response Cookies Collection
- Headers Collection
- Response Headers Collection
- Form Collection
- Querystring Collection
- Server Variables
A Sample HTML Trace .aspx file show up as below:
——————————————————————–
Request Details | |||||||||
Session Id: | yydykyze0tdvtgjk5emkdr55 | Request Type: | GET | ||||||
Time of Request: | 8/26/2015 4:31:31 AM | Status Code: | 200 | ||||||
Request Encoding: | Unicode (UTF-8) | Response Encoding: | Unicode (UTF-8) | ||||||
Trace Information | |||||||||
Category | Message | From First(s) | From Last(s) | ||||||
aspx.page | Begin PreInit | ||||||||
aspx.page | End PreInit | 4.13E-05 | 0.000041 | ||||||
aspx.page | Begin Init | 7.57E-05 | 0.000034 | ||||||
aspx.page | End Init | 0.000101689 | 0.000026 | ||||||
aspx.page | Begin InitComplete | 0.000125994 | 0.000024 | ||||||
aspx.page | End InitComplete | 0.000145549 | 0.00002 | ||||||
aspx.page | Begin PreLoad | 0.000163987 | 0.000018 | ||||||
aspx.page | End PreLoad | 0.000181587 | 0.000018 | ||||||
aspx.page | Begin Load | 0.000215949 | 0.000034 | ||||||
aspx.page | End Load | 0.000236343 | 0.00002 | ||||||
aspx.page | Begin LoadComplete | 0.000258692 | 0.000022 | ||||||
aspx.page | End LoadComplete | 0.00027741 | 0.000019 | ||||||
aspx.page | Begin PreRender | 0.000295289 | 0.000018 | ||||||
aspx.page | End PreRender | 0.000314844 | 0.00002 | ||||||
aspx.page | Begin PreRenderComplete | 0.000333003 | 0.000018 | ||||||
aspx.page | End PreRenderComplete | 0.000350883 | 0.000018 | ||||||
aspx.page | Begin SaveState | 0.000413181 | 0.000062 | ||||||
aspx.page | End SaveState | 0.000437206 | 0.000024 | ||||||
aspx.page | Begin SaveStateComplete | 0.000455924 | 0.000019 | ||||||
aspx.page | End SaveStateComplete | 0.000477994 | 0.000022 | ||||||
aspx.page | Begin Render | 0.000496432 | 0.000018 | ||||||
aspx.page | End Render | 0.000547276 | 0.000051 | ||||||
Control Tree | |||||||||
Control UniqueID | Type | Render Size Bytes (including children) | ViewState Size Bytes (excluding children) | ControlState Size Bytes (excluding children) | |||||
__Page | ASP.showhttptrace_aspx | 0 | 0 | 0 | |||||
Session State | |||||||||
Session Key | Type | Value | |||||||
Application State | |||||||||
Application Key | Type | Value | |||||||
Request Cookies Collection | |||||||||
Name | Value | Size | |||||||
Response Cookies Collection | |||||||||
Name | Value | Size | |||||||
Headers Collection | |||||||||
Name | Value | ||||||||
Cache-Control | max-age=0 | ||||||||
Connection | keep-alive | ||||||||
Accept | text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 | ||||||||
Accept-Encoding | gzip, deflate | ||||||||
Accept-Language | en-US,en;q=0.5 | ||||||||
Host | www.mynslab.com | ||||||||
User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0 | ||||||||
Response Headers Collection | |||||||||
Name | Value | ||||||||
X-AspNet-Version | 2.0.50727 | ||||||||
Cache-Control | private | ||||||||
Content-Type | text/html | ||||||||
Form Collection | |||||||||
Name | Value | ||||||||
Querystring Collection | |||||||||
Name | Value | ||||||||
Server Variables | |||||||||
Name | Value | ||||||||
ALL_HTTP | HTTP_CACHE_CONTROL:max-age=0 HTTP_CONNECTION:keep-alive HTTP_ACCEPT:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 HTTP_ACCEPT_ENCODING:gzip, deflate HTTP_ACCEPT_LANGUAGE:en-US,en;q=0.5 HTTP_HOST:www.mynslab.com HTTP_USER_AGENT:Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0 | ||||||||
ALL_RAW | Cache-Control: max-age=0 Connection: keep-alive Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Encoding: gzip, deflate Accept-Language: en-US,en;q=0.5 Host: www.mynslab.com User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0 | ||||||||
APPL_MD_PATH | /LM/W3SVC/2/ROOT | ||||||||
APPL_PHYSICAL_PATH | C:\inetpub\wwwroot\TestTrace\ | ||||||||
AUTH_TYPE | |||||||||
AUTH_USER | |||||||||
AUTH_PASSWORD | |||||||||
LOGON_USER | |||||||||
REMOTE_USER | |||||||||
CERT_COOKIE | |||||||||
CERT_FLAGS | |||||||||
CERT_ISSUER | |||||||||
CERT_KEYSIZE | |||||||||
CERT_SECRETKEYSIZE | |||||||||
CERT_SERIALNUMBER | |||||||||
CERT_SERVER_ISSUER | |||||||||
CERT_SERVER_SUBJECT | |||||||||
CERT_SUBJECT | |||||||||
CONTENT_LENGTH | 0 | ||||||||
CONTENT_TYPE | |||||||||
GATEWAY_INTERFACE | CGI/1.1 | ||||||||
HTTPS | off | ||||||||
HTTPS_KEYSIZE | |||||||||
HTTPS_SECRETKEYSIZE | |||||||||
HTTPS_SERVER_ISSUER | |||||||||
HTTPS_SERVER_SUBJECT | |||||||||
INSTANCE_ID | 2 | ||||||||
INSTANCE_META_PATH | /LM/W3SVC/2 | ||||||||
LOCAL_ADDR | 192.168.1.101 | ||||||||
PATH_INFO | /ShowHttpTrace.aspx | ||||||||
PATH_TRANSLATED | C:\inetpub\wwwroot\TestTrace\ShowHttpTrace.aspx | ||||||||
QUERY_STRING | |||||||||
REMOTE_ADDR | 192.168.1.10 | ||||||||
REMOTE_HOST | 192.168.1.10 | ||||||||
REMOTE_PORT | 37893 | ||||||||
REQUEST_METHOD | GET | ||||||||
SCRIPT_NAME | /ShowHttpTrace.aspx | ||||||||
SERVER_NAME | www.mynslab.com | ||||||||
SERVER_PORT | 80 | ||||||||
SERVER_PORT_SECURE | 0 | ||||||||
SERVER_PROTOCOL | HTTP/1.1 | ||||||||
SERVER_SOFTWARE | Microsoft-IIS/7.5 | ||||||||
URL | /ShowHttpTrace.aspx | ||||||||
HTTP_CACHE_CONTROL | max-age=0 | ||||||||
HTTP_CONNECTION | keep-alive | ||||||||
HTTP_ACCEPT | text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 | ||||||||
HTTP_ACCEPT_ENCODING | gzip, deflate | ||||||||
HTTP_ACCEPT_LANGUAGE | en-US,en;q=0.5 | ||||||||
HTTP_HOST | www.mynslab.com | ||||||||
HTTP_USER_AGENT | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0 | ||||||||
Microsoft .NET Framework Version:2.0.50727.5420; ASP.NET Version:2.0.50727.5420 |
——————————————————————–
Resources: