<%
' declare variables
Dim x, i
' set some session variables to display
Session("Authorized") = False
Session("IP") = Request.ServerVariables("REMOTE_ADDR")
Session("CurrentPage") = Request.ServerVariables("SCRIPT_NAME")
' call the SessInfo function
x = SessInfo
' loop through the results of the function (2 dimensional array)
For i = 0 to UBOUND(x, 1)
response.write "Session(""" & _
x(i, 0) & """) = " & x(i, 1) & "<BR>"
Next
%>
This example writes the following string to the browser:
Session("AUTHORIZED") = False
Session("IP") = your IP address
Session("CURRENTPAGE") = /path to/this asp page.asp
<%
Private Function SessInfo()
Dim Item, tmp1, tmp2, a, b, i, ct
Dim Stuff()
For Each Item In Session.Contents
tmp1 = tmp1 & Item & "]["
tmp2 = tmp2 & Session(Item) & "]["
Next
ct = CLng( CLng( Session.Contents.Count ) - 1 )
Redim Stuff(ct, 1)
a = split(tmp1, "][")
b = split(tmp2, "][")
For i = 0 to ubound(a) - 1
Stuff(i, 0) = CStr( a(i) )
Stuff(i, 1) = CStr( b(i) )
Next
SessInfo = Stuff
End Function
%>