ALP Request.QueryString collection
Contains the parameters sent through the HTTP query string. These are the value pairs found after the "?" mark in the URL. Request can be generated by clicking a hyperlink, submitting a form using GET method, writing the URL in the browser's address bar. Format assumed by the ALP engine and respectively by the ASP module is:

alp://<path>/script.asp?param1=value1&param2=value2&..

In other words parameter list (after the "?" mark) is assumed to contain parameter_name=value pairs and is often called query string. The parameter_name can be any value and is treated as text. It is not required parameter names to be unique - collection holds subcollections of values for every parameter_name found in the query string.

Syntax:

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

Parameters:

variable - can be string or numeric 1-based index of the parameter_name (in old versions of ASP it can only be a name)

index - is a 1-based index of the value for the specified parameter

All parameters are optional thus you can use Request.QueryString in the script and it will return the entire query string. Omitting the index parameter will return the first value of the given parameter specified by the variable. If a particular parameter does not exists empty string is returned.

Examples:

Following example lines will use this sample URL:

alp://c:/site/script.asp?a=v1&b=v2&c=v3&a=v4&a=v5&a=v6

JScript/VBScript:

<%= Request.QueryString("a") %>

Will return v1

<%= Request.QueryString("c") %>

Will return v3

<%= Request.QueryString("b").Count %>

Will return 1

<%= Request.QueryString("a") %>

Will return 4

<%= Request.QueryString("a")(2) %>

Will return v4

<%= Request.QueryString("d") %>

Will return empty string

Collections can be also enumerated:

VBScript:

<%
  For Each item In Request.QueryString("a")
    Response.Write item & "<BR>"
  Next
%>

This will produce:
v1
v4
v5
v6

Remarks:

QueryString collection is implemented using the newObjects Collections components see Request collections comments for more information.

Applies to: Request object

See also: notes about the Request collections

 

newObjects Copyright 2001-2006 newObjects [ ]