Home > Interview Questions > ASP.NET > What is Query String in asp.net?

What is Query String in asp.net?

by Thamil   on 04/10/2015   Category: ASP.NET   |  Level: Intermediate   |  Views: 1489    |  Points: 25     |  Gold 

Querystring is used to pass the data from one html or web forms to other web forms in asp.net. Querystring is one of the options to pass values from one page other page and It allow user can add multiple querysring in the end of URL following the question mark ‘? ‘character.
Below is the sample querystring to pass values to webform1 page

Get values from querystring
 string ID = Request.QueryString["ID"];
string Name = Request.QueryString["Name"];
if (!String.IsNullOrEmpty(Name))
foreach (string qr in Request.QueryString)

Advantages of query string

• All browsers will support query string and easy to code and use.
• It does not require any server resource to pass values between pages.

Disadvantages of query string

• Querystring value is visible to the user in url so we should avoid sending any sensitive data and it would allow to send space and & characters through querystring.
• QueryString does not support passing many values between pages and many browsers supports only 255 characters in the URL.

« What is difference between Response.Redirect and Server.Transfer in asp.net?
» What is a cookie in asp.net?
Post Question  |  Question Home

Recent Posts

User Responses

No response found, be the first to review this question.

Submit feedback about this code snippet

Please sign in to post feedback

Latest Posts