Help > Web Development > Reference > Scripting Objects > Request Object > QueryString Collection

Request.QueryString Collection

The QueryString collection gives you access to the variables in the current HTTP request query string. The query string is the part of the url proceeding the ? (question marker) and before the # (hash).

Properties
Count Returns the number of query string variables sent this request.
Item(name or index) Returns the query string variable value with the given name or index.
Key(index) Returns the name of the name of the query string variable at the given index.

Remarks
If the item requested does not exist in the collection Perceptive Enterprise Search will return Empty.

You can access a query string variable without specifying the Item property by calling Request.QueryString(variablename). 


Examples

Given the following URL:
http://localhost/mypage.html?firstName=John&lastName=Smith&address=123+some+street
To output specific query string variables you can specify the following script:
First Name: <%= Request.QueryString("firstName") %> 
Last Name: <%= Request.QueryString("lastName") %>
Address: <%= Request.QueryString("address") %>
To enumerate all query string variables use the following:
<% For I = 0 to Result.QueryString.Count - 1 %>
  <%= Request.QueryString.Key(I) %>: <%= Request.QueryString(I) %>
<% Next %>
To view all query string variables in the raw form:
<%= Request.QueryString %>
Applies To
Request Object