Active Server - Obtain The Entire Query String Without Entering Any Key Values


By now, you've probably used Request(.)QueryString a time or two to obtain the QueryString portion of your URL. Just to refresh your memory, this is the portion of the URL that looks like the following:


  • ?val1=Abc&val2=Def&val3=Ghi

Typically, we'd pull out each item one by one using its key value, like so:


  • ?field1 = Request(.)QueryString("val1")
  • field2 = Request(.)QueryString("val2")
  • field3 = Request(.)QueryString("val3")

However, did you know you could obtain the full QueryString value just by calling the function without any key values? To try it out, just enter the following line of code into your ASP page:


  • Response.write Request.QueryString & ""

You should see the entire QueryString without the address information. This little trick could come in handy if you have a large QueryString that you want to pass to another Web form or even if you-d rather parse the string yourself than list each individual member.

Go back