ASP QueryString collection
QueryString collection is used to retrieve the value of the variable in the HTTP query string.
HTTP query string is specified by the value after the question mark, for example, (?):
<a href= "test.html?txt=this is a query string test"> Link with a query string </a>
The above code generates a file named txt with the value "this is a query string test" variable.
Query strings are also generated by form submission, or by a user enters a query in the browser address bar.
NOTE: If you need to post large amounts of data (more than 100kb), you can not use Request.QueryString.
grammar
参数 | 描述 |
---|---|
variable | 必需。在 HTTP 查询字符串中要取回的变量名称。 |
index | 可选。为一个变量规定多个值之一。从 1 到 Request.QueryString(variable).Count。 |
Examples
Example 1
Traversal query string values of all variables n:
We assumed that this request is sent:
The names.asp contains the following code:
for i=1 to Request.QueryString("n").Count
Response.Write(Request.QueryString("n")(i) & "<br>")
next
%>
File names.asp will show:
Susan
Example 2
Suppose that the string is sent:
The above code produces the following QUERY_STRING value:
Now, we can use the information in the script:
Your age is <%= Request.QueryString("age")%>.
Output:
If you do not specify any variable values to be displayed, such as this:
Output will be like this:
Complete Request Object Reference