Click here to Skip to main content
14,171,916 members
Click here to Skip to main content
Add your own
alternative version

Tagged as


19 bookmarked
Posted 27 Feb 2009
Licenced CPOL

ASP Session Information (Classic)

, 27 Feb 2009
Rate this:
Please Sign up or sign in to vote.
View the contents of Classic ASP Memory


The first thing I do when I am asked to resolve an issue with a classic ASP application is to write a script to allow me to view the contents of memory.

This allows me to view an exact copy of all session variables, cookies, etc. at any stage in the application. I tend to have the application in one tab and the session info script in another, refreshing as I navigate the app.

I finally put together a reusable script and thought I would share.

ServerVariables.jpg - Click to enlarge image

The Render Function

Renders an HTML table containing the contents of the oCollection parameter:

Function RenderTOC(sTitle, oCollection)
	Tab		= Chr(9)
	NewLine = Chr(13)

	If IsObject(oCollection) Then
		If (oCollection.Count>0) Then
			Response.Write(NewLine & "<table>" & NewLine)
			Response.Write(Tab & "<caption>" & sTitle & _
						"</caption>" & NewLine)
			Response.Write(Tab & "<thead>" & NewLine)
			Response.Write(Tab & Tab & "<tr><th>Name</th>_
				<th>Type</th><th>Value</th></tr>" & NewLine)
			Response.Write(Tab & "</thead>" & NewLine)
			Response.Write(Tab & "<tbody>" & NewLine)
			For Each D in oCollection
				If (d<>"") And (oCollection(d)<>"") Then
					Response.Write(Tab & Tab)
					Response.Write("<th>" & _
						Server.HTMLencode(d) & "</th>")
					Response.Write("<td>" & TypeName(d) & _
					Response.Write("<td>" & _
					     & "</td>")
				End If
			Response.Write(Tab & "</tbody>" & NewLine)
			Response.Write("</table>" & NewLine)
		End If
	End If	
End Function

Using the Code

'  render contents of Request.Application
Call RenderTOC("Application Variables", Application.Contents)

' render contents of Request.Cookies
Call RenderTOC("Cookies", Request.Cookies)

' render contents of Request.SessionVariables
Call RenderTOC("Server Variables", Request.ServerVariables)

' render contents of Request.Form 
Call RenderTOC("Form Collection", Request.Form)

' render contents of Request.Querystring
Call RenderTOC("Querystring Collection", Request.Querystring)

' render contents of Session collection
Call RenderTOC("Session Variables", Session.Contents)

Be Sensible!

It is important not to upload this script to a production server and forget about it, as it exposes privileged information (database connection strings, etc.).

I have attached an ASP script so you can drop this on your server, tweak the accessible IP address and away you go!


  • 27th February, 2009: Initial post


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

John Doherty
Chief Technology Officer
United Kingdom United Kingdom
Senior Web Developer, Systems Architect and Entrepreneur. Technical Director of More information is available at

You may also be interested in...

Comments and Discussions

Generalgood session management Pin
Member 110714717-Jun-10 18:06
memberMember 110714717-Jun-10 18:06 
GeneralComment Pin
trip198217-Nov-09 6:53
membertrip198217-Nov-09 6:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web05 | 2.8.190524.2 | Last Updated 27 Feb 2009
Article Copyright 2009 by John Doherty
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid