The Use of query string in web application
We pass the value from one page to another page by query string, we write the syntax as
1) Response.Redirect("Default.aspx?query=John Smith");
where "query" is query string variable and "John Smith" is the string value for query variable.
Now we access the value on Default.aspx page as

string query=Request.QueryString["query"].toString();

2) we pass the multiple parameter by query string then we write the syntax as

Response.Redirect("Default.aspx?query1=John Smith &query2=krish");

Now we access the value on Default.aspx page as

string query1=Request.QueryString["query1"].toString();
string query2=Request.QueryString["query2"].toString();

string query1=Request.QueryString[0].toString();
string query2=Request.QueryString[1].toString();

string query1=Request.Params[0].toString();
string query2=Request.Params[1].toString();

3) We pass the any value by query string as

string str="JohnSmith";

And access these value on another page by

string query=Request.QueryString["query"].toString();

Advantage of query string
it is easy to create for passing data from one page to another
It is visible in url
It contains high lenth data so it is not support to sending more data
  Modified On Sep-18-2014 01:23:52 PM

Leave Comment