%
'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
| Item Name |
Value |
<%
'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
%>
| <%= sKey %> |
<%= sValue %> |
<%
Next
%>
Application Object
| Item Name |
Value |
<%
If Application.Contents.Count = 0 Then
'Nothing in session
%>
| No data is currently being held in the application object! |
<%
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
%>
| <%= Application.Contents.Key(i) %> |
=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)
%>
Array: <%= Application.Contents.Key(i) %>( <%= LBound( Application.Contents.Item(i) ) %> To <%= UBound( Application.Contents.Item(i) ) %> ) |
<%
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
%>
<%= objArray %> |
<%
Next
ElseIf IsNull( Application.Contents.Item(i) ) Then
'Contains a NULL value
%>
<%= Application.Contents.Key(i) %> |
NULL |
<%
ElseIf Application.Contents.Item(i) = vbNullString Or IsEmpty( Application.Contents.Item(i) ) Then
'Contains an empty string or an empty variable
%>
<%= Application.Contents.Key(i) %> |
=Empty= |
<%
Else
'Anything not covered by the above tests,
' treat it as a straight literal variable and
' display its name and value
%>
<%= Application.Contents.Key(i) %> |
<%= Application.Contents.Item(i) %> |
<%
End If
%>
<%
Next
End If
%>
Session Object
| Property |
Value |
| Session ID |
<%= Session.SessionID %> |
| Session Timeout |
<%= Session.Timeout %> |
| Session Codepage |
<%= Session.CodePage %> |
| Session Locale |
<%= Session.LCID %> |
| |
| Key Name |
Value |
<%
'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
%>
| No data is currently being held in the session object! |
<%
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
%>
| <%= Session.Contents.Key(i) %> |
=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)
%>
Array: <%= Session.Contents.Key(i) %>( <%= LBound( Session.Contents.Item(i) ) %> To <%= UBound( Session.Contents.Item(i) ) %> ) |
|
<%
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
%>
<%= objArray %> |
<%
Next
ElseIf IsNull( Session.Contents.Item(i) ) Then
'Contains a NULL value
%>
<%= Session.Contents.Key(i) %> |
=NULL= |
<%
ElseIf Session.Contents.Item(i) = vbNullString Or IsEmpty( Session.Contents.Item(i) ) Then
'Contains an empty variable or an empty string
%>
<%= Session.Contents.Key(i) %> |
=Empty= |
<%
Else
'Anything not covered by the above tests,
' treat it as a straight literal variable and
' display its name and value
%>
<%=Session.Contents.Key(i) %> |
<%=Session.Contents.Item(i) %> |
<%
End If
%>
<%
Next
End If
%>
Cookie Object
| Key Name |
Value |
<%
'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), "=" ) )
%>
| <%= sCookie & " : " & sKey %> |
<%= sValue %> |
<%
Next
Else
'Value holds just one item
%>
| <%= sCookie %> |
<%= sValue %> |
<%
End If
Next
Else
'No cookies were found
%>
| No cookies are available! |
<%
End If
%>
Form Object
| Item Name |
Value |
<%
'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
%>
| <%= Request.Form.Key( i ) %> |
<%= Request.Form.Item( i ) %> |
<%
Next
Else
'No data was supplied via this method
%>
| No data was supplied via the form object! |
<%
End If
%>
QueryString Object
| Item Name |
Value |
<%
'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
%>
| <%= Request.QueryString.Key( i ) %> |
<%= Request.QueryString.Item( i ) %> |
<%
Next
Else
'No data was supplied via this method
%>
| No data was supplied via the querystring object! |
<%
End If
%>