Posted 16 years ago on 7/17/2007 and updated 12/29/2008
Take Away: Although you can use the generic request collection, as in Request("SomeValue"), for either Request.Form("SomeValue") or Request.QueryString("SomeValue"), it's best to avoid the generic request collection until it's really needed. Use a For Each loop to loop through elements.
Although you can use the generic request collection, as in Request("SomeValue"), for either Request.Form("SomeValue") or Request.QueryString("SomeValue"), it's best to avoid the generic request collection until it's really needed. The generic request collection causes problems in some circumstances. For example, you cannot call the generic request collection after a BinaryRead.
Looping Through Request.QueryString
Here's an example of looping through the QueryString writing out each key and value pair:
Dim Key
For each Key in Request.QueryString Response.Write Key & "=" & Request.QueryString(Key) Next
Display First QueryString Value
The following code snippte will display the first query string value:
If Len(Request.QueryString) > 0 Then Response.Write "First value is " & Request.QueryString(1) Else Response.Write "No query string." End If