To read the article online, visit

User Tips: Listing the Contents of the Session and Application Objects

By Stephen V.

Here's a page I wrote to show the contents of the session and application collections. It has proved pretty useful for me, and I figure if I can save someone else time writing it, then more power to me. :)

This code will show the contents of arrays in a collection, but it will not show the contents of arrays within arrays within a collection (how's that for confusing?). A more ambitious coder could easily modify it to recurse more deeply, but I hope few people are actually putting array arrays into the session/application.

dim item 'will be used to iterate through the contents %>
  <title>Collection Information</title>
	<th colspan=2>Session</th>
  'In case a particular item gives us trouble
  on error resume next

  for each item in Session.Contents  %>
	<td><%=item%></td>  <%'Show the item's name %>
	<TD><%=dumpitem(Session(item))%> <%'Show the Item's contents%>
   next 'For each%>

	<th colspan=2>Application</th>
<% for each item in Application.Contents  %>
<% next %>
   function dumpItem(item)
        'If it's an array we use this to iterate through it
        dim subItem
        dim result  'Will store the result

        'If it's an array we have to
        'grab its contents.  
        if TypeName(item) = "Variant()" then 
          for each subItem in item
             'Separate each with a space
             result = result & " " & subItem
          result = item
        end if

        dumpItem = result
    end function

Happy Programming!

Return to user tips...

Article Information
Article Title: User Tips: Listing the Contents of the Session and Application Objects
Article Author: Stephen V.
Article URL:

Copyright 2019 QuinStreet Inc. All Rights Reserved.
Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers