Query strings are usually used to send information from one page to another page.
Example
The following string might be sent:
http://www.aspx?name=John&age=30 |
this results in the following QUERY_STRING value:
name=John&age=30 |
Now we can use the information in a script:
Hi, <%=Request.QueryString["name"]%>. Your age is <%= Request.QueryString["age"]%>. |
Output:
Hi, John. Your age is 30. |
If you do not specify any variable values to display, like this:
Query string is: <%=Request.QueryString%> |
the output would look like this:
Query string is: name=John&age=30 |
-------------------
Get value from URL, and pass to string.
Response.Redirect("foo.aspx?id=1&name=foo"); // pass from other page
string id = Request.QueryString["id"]; // obtain from this page
string name = Request.QueryString["name"]; // obtain from this page