<SCRIPT RUNAT=Server Language=VBScript>
Class clsDebug
Dim blnEnabled
Dim dteRequestTime
Dim dteFinishTime
Dim objStorage
Public Property Get Enabled()
Enabled = blnEnabled
End Property
Public Property Let Enabled(bNewValue)
blnEnabled = bNewValue
End Property
Private Sub Class_Initialize()
dteRequestTime = Now()
Set objStorage = Server.CreateObject("Scripting.Dictionary")
End Sub
Public Sub Print(label, output)
If Enabled then
objStorage.Add label, output
End if
End Sub
Public Sub [End]()
dteFinishTime = Now()
If Enabled then
PrintSummaryInfo()
PrintCollection "VARIABLE STORAGE", objStorage
PrintCollection "QUERYSTRING COLLECTION", Request.QueryString()
PrintCollection "FORM COLLECTION", Request.Form()
PrintCollection "COOKIES COLLECTION", Request.Cookies()
PrintCollection "SESSION CONTENTS COLLECTION", Session.Contents()
PrintCollection "SERVER VARIABLES COLLECTION", Request.ServerVariables()
PrintCollection "APPLICATION CONTENTS COLLECTION", Application.Contents()
PrintCollection "APPLICATION STATICOBJECTS COLLECTION", Application.StaticObjects()
PrintCollection "SESSION STATICOBJECTS COLLECTION", Session.StaticObjects()
End if
End Sub
Private Sub PrintSummaryInfo()
With Response
.Write("<hr>")
.Write("<b>SUMMARY INFO</b></br>")
.Write("Time of Request = " & dteRequestTime) & "<br>"
.Write("Time Finished = " & dteFinishTime) & "<br>"
.Write("Elapsed Time = " & DateDiff("s", dteRequestTime, dteFinishTime) & " seconds<br>")
.Write("Request Type = " & Request.ServerVariables("REQUEST_METHOD") & "<br>")
.Write("Status Code = " & Response.Status & "<br>")
End With
End Sub
Private Sub PrintCollection(Byval Name, Byval Collection)
Dim varItem
Response.Write("<br><b>" & Name & "</b><br>")
For Each varItem in Collection
Response.Write(varItem & "=" & Collection(varItem) & "<br>")
Next
End Sub
Private Sub Class_Terminate()
Set objStorage = Nothing
End Sub
End Class
</SCRIPT>