views:

152

answers:

3

I have some doubts. What is querystrng? how we can use it? what are the advantages? what are the parameters using for querystring?

A: 

query string is one of the state management techniques in .net. You can pass parameters from one page to another page like Response.Redirect("test.aspx?id=101"); and you can access those values in recieving page.

here it is test.apsx. in test.aspx page load you can retieve those values by

string id = Request.QueryString["id"].ToString();
Nagu
You don't need the ToString() here, it already is a string.
Colin
It's also not a .NET state management technique - it's a standard part of URLs since way before .NET.
John Saunders
+2  A: 

The Query string entry says:

In World Wide Web, a query string is the part of a Uniform Resource Locator (URL) that contains data to be passed to web applications such as CGI programs.

and

A typical URL containing a query string is as follows:

http://server/path/program?query_string

When a server receives a request for such a page, it runs a program (if configured to do so), passing the query_string unchanged to the program. The question mark is used as a separator and is not part of the query string.

gimel
A: 

The original use case for a query string was the kind of page that had a "Search:" label next to a text box, with "Submit" and "Reset" buttons under it. You'd fill in the text box and click "Submit" and it would issue a "GET" request, perhaps to the same URL, where it would do a search based on the query you typed in.

The stuff you typed into the text box would be placed into the query string.

John Saunders