Tuesday, September 20, 2011

Simple explanation about Query String in Asp.net

Hi friends.Here i am going explain about Query String in simple way.Actually we know that it is one of the way of the Client side Management Technique.it is one of the important technique inclient side management technique

 
QueryStrings(URL):

It is a client side management technique. It is used to pass the values or information from one page to another page through URL.

Example:
For example There are two pages named as FirstPage.aspx and SecondPage.aspx
Our aim that we will pass the user's information from the FirstPage to SecondPage through URL.
In FirstPage.aspx, Passing information(fName,lName) to the SecondPage.aspx with the URL. Simply it is an URL, with a question mark ?, followed by a key value pair.

FirstPage.aspx:
Response.Redirect("SecondPage.aspx?firstName=Bhaskar & lastName=Kovvuri");


In SecondPage.aspx, we must use the HttpRequest object to read the user's information which we passed from the FirstPage.aspx.

SecondPage.aspx:

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

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

Response.Write("Hello,"+fName+" "+lName);  


The Result in the SecondPage.aspx page is

Hello,Bhaskar Kovvuri

Advantages:

1.Very easy to implement.
2. No postback operations from the Server.

Limitations and Disadvantages:

1.Limit on length of querystring the particular browser allows.
Maximum lenght is based on the browser not depend upon the ASP.Net
Internet Explorer(4.0,5.0,6.0,7.0) supports ---> ~2048 characters(i.e.,256bytes)
Opera supports ---> ~4050 characters
NetScape 6 supports ---> ~2000 characters

2.No Security.(It can be read or modified by anyone in URL)
3 No peristency.(Doesn't Remember the information in a querystring after the user leaves that page.)
4. Limited to use only strings.No support for storing Structural Data(ArrayLists,Controls,Structures,Classes etc.,)

NOTE: There is no limit on the number of parameters you can pass in the URL, but Limit only on the "Length".

Labels: , , , ,

2 Comments:

At September 20, 2011 at 9:30 AM , Anonymous Anonymous said...

Nice explanation....

 
At December 24, 2013 at 11:50 PM , Blogger Unknown said...

Good

 

Post a Comment

Subscribe to Post Comments [Atom]

<< Home