DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Auto-store All Request Variables

07.31.2006
| 7430 views |
  • submit to reddit
        // Puts all request variables into local variables.  Never type request.querystring again.  Easily modified to work with option explicit.

<%
	For each item in Request.querystring
		If not len(item) <= 0 Then
			Execute("[" & item & "] = Request(""" & item & """)")
		End If
	Next

	For each item in Request.form
		If not len(item) <= 0 Then
			Execute("[" & item & "] = Request(""" & item & """)")
		End If
	Next
%>
    

Comments

Snippets Manager replied on Mon, 2006/07/31 - 5:00pm

This is obviously not for use in a public environment, as you quite rightly say.

Snippets Manager replied on Mon, 2012/05/07 - 2:25pm

You realize this is insecure? In general you should avoid runtime evaluators like Execute. Ever heard of sql injection attacks? Your code is subject to something similar. The hacker would only have to create the right querystring to cause it to execute his code.