ASP Request.QueryString Collection

The ASP Request.QueryString Collection is used to get the value of the variable that will be stored in the HTTP query string from the URL. 

The  Query string is a part of the URL that begins with a question mark (?). Generally, it contains the information of the user. 

<a href= “geek.asp?txt=this is a query string test”>Link with a query string</a> 

Syntax

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

Parameter Values:

  • variable: It is a required attribute. It defines the name of the variable in the HTTP Query String.
  • index: It is an optional parameter. It defines one of the multiple values for a variable. which varies From 1 to Request.QueryString(variable).Count

 

Example: Below ASP code returns all the values of the variable from the following Request Query String. 

The following request is sent: 

https://www.w3wiki.net/sudo/Beginner.asp?x=Manas&x=Sushant

Beginner.asp




<%
for i=1 to Request.QueryString("x").Count
  Response.Write(Request.QueryString("x")(i) & "<br>")
next
%>


Output 

Manas
Sushant

Contact Us