Saturday, August 1, 2009

Loop through Session ,Application ,form Variable

In Classic asp sometime we need to retrieve all the Session Application and Request object variable, in this case we can use Loop through technique which will generate all the Session variable , application variable , and Request variable are used in current page do this need to simply put this line on your page

1.

<%
dim i
For Each i in Session.Contents
Response.Write(i & "<br />")
Next

dim i
For Each i in Session.StaticObjects
Response.Write(i & "<br />")
Next
%>

it will Display all the Session Contents / session staticobjets are used in current page .


2.

<%
dim i
For Each i in Application.Contents
Response.Write(i & "<br />")
Next
%>


this will iterate all the Application content are being used in current page.

3.

<%
for each x in Request.form
Response.Write("<br>" & x & " = " & Request.form(x))
next
%>


this will generate all the Request variable


4.


<%
for each name in Request.ServerVariables
Response.write ""&name &"-------------"& Request.ServerVariables(name) &"<br>"
Next
%>

it will loop with the all the Server Variable.

No comments:

Post a Comment