Monday, September 14, 2009

Old Skool - Classic ASP ServerVariables List

This is an oldie but a goodie – I don’t know how many times in my career I’ve rewritten these few lines of code but I’ve preserved it here to save me writing it yet again! A simple method for outputting all the server variables, query string parameters and form variables in Classic ASP!

response.Write("<hr/>SERVER VARIABLES COLLECTION<br/>")
Dim variableName
for each variableName in Request.ServerVariables
response.write(variableName & ": " & Request.ServerVariables(variableName) & "<br/>")
next
response.Write("<hr/>QUERY STRING COLLECTION<br/>")
for each variableName in Request.QueryString
response.write(variableName & ": " & Request.QueryString(variableName) & "<br/>")
next
response.Write("<hr/>FORM COLLECTION<br/>")
for each variableName in Request.Form
response.write(variableName & ": " & Request.Form(variableName) & "<br/>")
next
response.Write("<hr/>SESSION COLLECTION<br/>")
for each variableName in Session.Contents
response.write(variableName & ": " & Session(variableName) & "<br/>")
next
response.Write("<hr/>")

2 comments:

Anonymous said...

Hey - I am definitely glad to find this. cool job!

Anonymous said...

Come to see us at times to come by more information and facts anyway Come to see us now to obtain more facts and facts anyway [url=http://www.polandlimoservice.com]przewóz osób[/url]