QueryString

The QueryString collection retrieves the values of the variables in the content query string. The content query string is specified by the values following the question mark (?). Several different processes can generate a query string. For example, the anchor tag

<A HREF= "invoice.vbs?id=12345678">Click here to open your invoice</A>

generates a variable named id with the value "12345678"

Syntax

Request.QueryString(variable)[(index)|.Count]

 

Parameters
variable
Specifies the name of the variable in the content query string to retrieve.
index
An optional parameter that enables you to retrieve one of multiple values for variable. It can be any integer value in the range 1 to Request.QueryString(variable).Count.
Remarks

The QueryString collection is a parsed version of the QUERY_STRING variable in the ServerVariables collection. It enables you to retrieve the QUERY_STRING variable by name. The value of Request.QueryString(parameter) is an array of all of the values of parameter that occur in QUERY_STRING. You can determine the number of values of a parameter by calling Request.QueryString(parameter).Count. If a variable does not have multiple data sets associated with it, the count is 1. If the variable is not found, the count is 0.

To reference a QueryString variable in one of multiple data sets, you specify a value for index. The index parameter can be any value between 1 and Request.QueryString(variable).Count. If you reference one of multiple QueryString variables without specifying a value for index, the data is returned as a comma-delimited string.

When you use parameters with Request.QueryString, the server parses the parameters sent to the request and returns the specified data. If your application requires unparsed QueryString data, you can retrieve it by calling Request.QueryString without any parameters.

Example

The mail body links to the invoice content

invoice.vbs?id=12345678
results in the following Request.QueryString("id") value:
12345678 

If the following script is used:

The unparsed query string is: <%=Request.QueryString%>
The output would be
The unparsed query string is: id=12345678
Applies To

Request Object

See Also

ServerVariables



©2001-2015 eMill. All trademarks property of their owners.