Using the Form Collection

Using the QueryString Collection

Use the QueryString collection of the Request object to extract information from the header of an HTTP request message.

When a user submits a form with the GET method or appends parameters to a URL request, you can use the QueryString collection to read the submitted information.

The values you read from the request are the parameters that appear after the question mark ( ? ).

click to view at full size.

Figure 10.2 An HTTP request message containing submitted information
Note

The QueryString collection is a parsed version of the QUERY_STRING variable of the ServerVariables collection. The QueryString collection enables you to retrieve the QUERY_STRING parameters by name .


You can loop through all of the values in a query string to extract information passed by the user.

Example

This example loops through all of the values in an HTTP request:
 <%For Each Item In Request.QueryString 'Display the Item Next %> 
If more than one value is submitted with the same value namesuch as a multiselect list box on a formyou can use the index of the QueryString collection variable to access the individual values.

Example

This example shows how to access the first and second value of a variable named "sport" in the QueryString collection:
 Request.QueryString("sport")(0) Request.QueryString("sport")(1) 


Microsoft Windows Architecture Training
Microsoft Windows Architecture for Developers Training Kit
ISBN: B00007FY9D
EAN: N/A
Year: 1998
Pages: 324

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net