/ Published in: ASP
List Session and Application Variables
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<%@ Language=VBScript %> <% Option Explicit %> <% 'How many session variables are there? Response.Write "There are " & Session.Contents.Count & _ " Session variables<P>" Dim strName, iLoop 'Use a For Each ... Next to loop through the entire collection For Each strName in Session.Contents 'Is this session variable an array? If IsArray(Session(strName)) then 'If it is an array, loop through each element one at a time For iLoop = LBound(Session(strName)) to UBound(Session(strName)) Response.Write strName & "(" & iLoop & ") - " & _ Session(strName)(iLoop) & "<BR>" Next Else 'We aren't dealing with an array, so just display the variable Response.Write strName & " - " & Session.Contents(strName) & "<BR>" End If Next %>
URL: http://www.psacake.com/web/hl.asp