<% 'This ASP script originally lived at http://evolvedcode.net/ for the 'original version of this script and a wide variety of other 'scripts, please visit the site. Option Explicit Function GetHiLo( ByRef bMark ) 'Simple function to select & toggle the background shading ' between the high color and the low color If bMark Then GetHiLo = "ColorHi" Else GetHiLo = "ColorLo" End If 'Invert the current selection bMark = Not bMark End Function Function ComplexFilter( ByVal objData ) 'Code to handle situations where we have been passed complex data If IsArray( objData )Then ComplexFilter = "<< Array >>" ElseIf IsObject( objData )Then ComplexFilter = "<< Object >>" ElseIf IsNull( objData )Then ComplexFilter = "<< Null >>" ElseIf IsEmpty( objData )Then ComplexFilter = "<< Empty >>" Else ComplexFilter = objData End If End Function Dim i, j, sKey, sValue, bMark Dim sTmp, sCookie, objArray 'Take measures to ensure that this page is the most ' current page and not a cached version of it Response.AddHeader "Cache-Control", "no-cache" Response.Expires = -1 Response.CacheControl = "no-cache" 'Set the variable which we use to track hi/lo toggle bMark = False %> State Diagnostics

Dynamic State Display

Server Variables

<% 'Cycle through all the items that compose the server ' variables collection For i = 1 To Request.ServerVariables.Count 'Store the key name and the associated item value to ' variables sKey = Request.ServerVariables.Key(i) sValue = Request.ServerVariables.Item(i) 'Tidy them up as needed If sKey = vbNullString Then sKey = " " End If If sValue = vbNullString Then sValue = " " End If If Left( sKey, 4 ) = "ALL_" Then sValue = Replace( sValue, vbCrLf, "
" ) sValue = Replace( sValue, vbCr, "
" ) sValue = Replace( sValue, vbLf, "
" ) End If 'Display the item %> <% Next %>
Item Name Value
<%= sKey %> <%= sValue %>

Application Object

<% If Application.Contents.Count = 0 Then 'Nothing in session %> <% Else 'Cycle through all the items that compose the server ' variables collection For i = 1 To Application.Contents.Count %> <% 'Handle display based on the type of object ' that it contains If IsObject( Application.Contents.Item(i) ) Then 'Contains an object variable of some type ' or other, output the name and state it is an ' object %> <% ElseIf IsArray( Application.Contents.Item(i) ) Then 'Contains an array of objects, start by displaying ' the array name then cycle through the array ' and display them (note: assumes they are literals ' in a single dimensional array) %> <% For Each objArray In Application.Contents.Item(i) If IsArray( objArray ) Then objArray = "=Array=" ElseIf IsObject( objArray ) Then objArray = "=Object=" ElseIf IsNull( objArray ) Then objArray = "=NULL=" ElseIf objArray = vbNullString Or IsEmpty( objArray ) Then objArray = "=Empty=" End If %> <% Next ElseIf IsNull( Application.Contents.Item(i) ) Then 'Contains a NULL value %> <% ElseIf Application.Contents.Item(i) = vbNullString Or IsEmpty( Application.Contents.Item(i) ) Then 'Contains an empty string or an empty variable %> <% Else 'Anything not covered by the above tests, ' treat it as a straight literal variable and ' display its name and value %> <% End If %> <% Next End If %>
Item Name Value
No data is currently being held in the application object!
<%= Application.Contents.Key(i) %> =Object=Array: <%= Application.Contents.Key(i) %>( <%= LBound( Application.Contents.Item(i) ) %> To <%= UBound( Application.Contents.Item(i) ) %> )<%= objArray %><%= Application.Contents.Key(i) %> NULL<%= Application.Contents.Key(i) %> =Empty=<%= Application.Contents.Key(i) %> <%= Application.Contents.Item(i) %>

Session Object

<% 'Once the default contents of the session have been output ' move on to the user-defined items. 'Check the session actually has something in it If Session.Contents.Count = 0 Then 'Nothing in session %> <% Else 'Cycle through each of the user-defined items For i = 1 To Session.Contents.Count %> <% 'Handle display based on the type of object ' that it contains If IsObject( Session.Contents.Item(i) ) Then 'Contains an object variable of some type ' or other, output the name and state it is an ' object %> <% ElseIf IsArray( Session.Contents.Item(i) ) Then 'Contains an array of objects, start by displaying ' the array name then cycle through the array ' and display them (note: assumes they are literals ' in a single dimensional array) %> <% For Each objArray In Session.Contents.Item(i) If IsArray( objArray ) Then objArray = "=Array=" ElseIf IsObject( objArray ) Then objArray = "=Object=" ElseIf IsNull( objArray ) Then objArray = "=NULL=" ElseIf objArray = vbNullString Or IsEmpty( objArray ) Then objArray = "=Empty=" End If %> <% Next ElseIf IsNull( Session.Contents.Item(i) ) Then 'Contains a NULL value %> <% ElseIf Session.Contents.Item(i) = vbNullString Or IsEmpty( Session.Contents.Item(i) ) Then 'Contains an empty variable or an empty string %> <% Else 'Anything not covered by the above tests, ' treat it as a straight literal variable and ' display its name and value %> <% End If %> <% Next End If %>
Property Value
Session ID <%= Session.SessionID %>
Session Timeout <%= Session.Timeout %>
Session Codepage <%= Session.CodePage %>
Session Locale <%= Session.LCID %>
 
Key Name Value
No data is currently being held in the session object!
<%= Session.Contents.Key(i) %> =Object=Array: <%= Session.Contents.Key(i) %>( <%= LBound( Session.Contents.Item(i) ) %> To <%= UBound( Session.Contents.Item(i) ) %> ) <%= objArray %><%= Session.Contents.Key(i) %> =NULL=<%= Session.Contents.Key(i) %> =Empty=<%=Session.Contents.Key(i) %> <%=Session.Contents.Item(i) %>

Cookie Object

<% 'Check we actually have some user-defined cookies ' available to us If Request.Cookies.Count > 0 Then 'Cookies were found, cycle through each cookie ' displaying their content For i = 1 To Request.Cookies.Count 'Store the name and value sCookie = Request.Cookies.Key(i) sValue = Request.Cookies.Item(i) 'Test if value holds multiple sub-keys If InStr( 1, sValue, "&" ) > 0 And InStr( 1, sValue, "=" ) > 0 Then 'Value does contain multiple sub-keys, ' cycle through each sub-key and display its ' name and value in turn sTmp = Split( sValue, "&" ) For j = LBound( sTmp ) To UBound( sTmp ) sKey = Left( sTmp(j), InStr( 1, sTmp(j), "=" ) - 1 ) sValue = Right( sTmp(j), Len( sTmp(j) ) - InStr( 1, sTmp(j), "=" ) ) %> <% Next Else 'Value holds just one item %> <% End If Next Else 'No cookies were found %> <% End If %>
Key Name Value
<%= sCookie & " : " & sKey %> <%= sValue %>
<%= sCookie %> <%= sValue %>
No cookies are available!

Form Object

<% 'Check if data was supplied via the form If Request.Form.Count > 0 Then 'Since we appear to have data, cycle through all items supplied to us, ' writing out the key name and the value of that item For i = 1 To Request.Form.Count %> <% Next Else 'No data was supplied via this method %> <% End If %>
Item Name Value
<%= Request.Form.Key( i ) %> <%= Request.Form.Item( i ) %>
No data was supplied via the form object!

QueryString Object

<% 'Check if data was supplied via the querystring If Request.QueryString.Count > 0 Then 'Since we appear to have data, cycle through all items supplied to us, ' writing out the key name and the value of that item For i = 1 To Request.QueryString.Count %> <% Next Else 'No data was supplied via this method %> <% End If %>
Item Name Value
<%= Request.QueryString.Key( i ) %> <%= Request.QueryString.Item( i ) %>
No data was supplied via the querystring object!