Advantages and disadvantages in asp.net of QueryString

Use of QueryString:


For Sending values to another page we will use QueryStringProperty of Request Object. While searching on the net you may see URL's like

"http://www.sitename.com/welcome.aspx?firstname=Parijat&lastname=Mishra".

Need of Encoding and Decoding QueryString:

URL of QueryString should contain only ASCII characters. So if you are passing other than ASCII Characters then they need to be encoded.

  • Asp.Net Framework provides two methods for
  •  HttpServerUtility.UrlEncode
  • HttpServerUtility.UrlDecode
  • For Encoding and Decoding characters.
How to use QueryString in asp.net:

Advantages of QueryString:

  • Easy to use and Efficient Technique
  • Light weight and not consume any server resource.
  • Seo Friendly. Where user can bookmark pages easily
  • Broad Support. Almost all browsers and devices support this.


Disadvantages of QueryString:

  •  Limited Capacity: Most browsers and client and devices allow to URL Length 255 characters limit.
  • We can pass information in string format only, to pass objects and large volumes of data we have to do lot more things.
  • Security: Information send through Query String we will see this on url so the data not be secured.


QueryString Class Hierarchy;

  • System.Object 
  • System.Web.UI.WebControls.Parameter
  • System.Web.UI.WebControls.QueryStringParameter

QueryString Constructors:

QueryStringParameter()
Initializes a new unnamed instance of the QueryStringParameter class.

QueryString Lazy way: 

QueryString is not filled in a lazy way. By the time your HttpRequest is being used, QueryString hasbeen initialized with all the  key-values.

Other Related Post :


Comments