Return To Home Page - Link to "The Wanker" - Contact Us




Return To Home Page

Displaying all Session and Application Variables

Often when using ASP or Active Server Pages you will find it necessary to do some troubleshooting. Below is some neat code you can run that will show you all the current Session and Application variables and really give you a good idea of what sort of information is being saved in them. At the bottom of this page we also show you a way to erase/clear all this information all at once.

<font face=arial size=1>
Session Variables - <% =Session.Contents.Count %> Found<br><br>
<%
Dim item, itemloop
For Each item in Session.Contents
  If IsArray(Session(item)) then
    For itemloop = LBound(Session(item)) to UBound(Session(item))
%>

<% =item %>  <% =itemloop %> <font color=blue><% =Session(item)(itemloop) %></font><BR>
<%
    Next
  Else
%>
<% =item %>
<font color=blue><% =Session.Contents(item) %></font><BR>
<%
  End If
Next
%>


<hr>

Application Variables - <% =Application.Contents.Count %> Found<br><br>
<%
For Each item in Application.Contents
  If IsArray(Application(item)) then
    For itemloop = LBound(Application(item)) to UBound(Application(item))
%>

<% =item %>   <% =itemloop %> <font color=blue><% =Application(item)(itemloop) %></font><BR>
<%
    Next
  Else
%>
<% =item %>
<font color=blue><% =Application.Contents(item) %></font><BR>
<%
  End If
Next
%>

</font>


Additionally, here is some handy code you can run that will wipe that information clean.

<%
Session.Abandon
Application.Contents.RemoveAll()
%>

ASP (Active Server Pages) is a technology developed by Microsoft. Pages using ASP are primarily developed in JScript, or VBScript and are integrated into the HTML of your Web pages. The ASP code is compiled on-the-fly by the server and the resulting output is standard HTML. By using ASP, Web pages can be dynamic, full of ever-changing content, and browser independent.
Active Server Pages ASP ASP.NET .aspx .ascx Web HTML Developer Internet Microsoft Web Services Visual Studio .NET CJWSoft ASPProtect ASPBanner ASPClassifieds www.aspclassifieds.com, www.powerasp.com,www.cjwsoft.com,www.aspphotogallery.com,www.codewanker.com,www.aspprotect.com,www.aspbanner.com,www.abay.com

 

Link to "The Wanker"
© 2007 CodeWanker - Active Server Pages Articles, Code Snippets, & Tutorials