The QueryString collection retrieves the values of the variables in the HTTP query string, that is, it retrieves the values encoded after the question mark (?) in an HTTP request. For example, it parses the values sent by a form using the GET method.
Specifies the name of the variable in the HTTP query string to retrieve.
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.
The QueryString collection is a parsed version of the QUERY_STRING variable in the ServerVariables collection. It enables you to retrieve the QUERY_STRING variables 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 may 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.
You can use an iterator to loop through all the data values in a query string. For example, if the following request is sent:
and Names.asp contained the following script:
---NAMES.ASP--- <% For Each item In Request.QueryString("Q") Response.Write item & "<BR>" Next %>
Names.asp would display the following:
The preceding script could also have been written using Count:
<% For I = 1 To Request.QueryString("Q").Count Response.Write Request.QueryString("Q")(I) & "<BR>" Next %>
The client request:
results in the QUERY_STRING value:
The QueryString collection would then contain two members, name and age. You can then use the following script:
Welcome, <%= Request.QueryString("name") %>.
Your age is <%= Request.QueryString("age") %>.
The output would be:
Welcome, Fred. Your age is 22.
ClientCertificate, Cookies, Form, ServerVariables
© Microsoft Corporation. All rights reserved.
|file: /Techref/language/asp/OBJ/introbj_10.htm, 4KB, , updated: 2001/3/2 14:37, local time: 2018/11/16 02:31,
|©2018 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?|
<A HREF="http://www.piclist.com/techref/language/asp/OBJ/introbj_10.htm"> QueryString</A>
|Did you find what you needed?|
PICList 2018 contributors:
o List host: MIT, Site host massmind.org, Top posters @20181116 RussellMc, Van Horn, David, Sean Breheny, David C Brown, Isaac M. Bavaresco, Bob Blick, Neil, John Gardner, AB Pearce - UKRI STFC, Harold Hallikainen,
* Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.
Welcome to www.piclist.com!