1. A Query String is a value specified in an HTTP query that can be accessed easily within ASP.NET. The query string is appended at the end of the URL following the question mark ('?') character. Multiple query strings can be specified in the URL by separating them by either an ampersand('&') or a semicolon(';').
QueryString: The Request.QueryString collection is a NameValueCollection. The NameValueCollection is associated with the String keys and String values that can be accessed either with the key or with the index.
Passing one Parameter
Passing two Parameters
Label1.Text = Request.QueryString["NAME"];
Or Label1.Text = Request["NAME"]
Count Query String Variables: Request.QueryString.Count.ToString();
Advantages of this approach
It is very easy.
Disadvantages of this approach
QueryString have a max length, If you have to send a lot information this approach does not work.
QueryString is visible in address bar of your browser so you should not use it with sensitive information.
QueryString can not be used to send & and space characters.
3. Session State: ASP.NET allows you to save values using session state. The scope of Session state is to the current browser session. If different users are using your application, each
will have a different session state. In addition, if the same user leaves your application and then returns later, that user will also have a different session state. Session state is stored in the Session object as key-value pairs between server round trips.
A session refers to the time duration during which a specific user is connected to a particular Web site. It begins when the user connects to the site and ends after user leaves the site. You can create a session object in the following way:
Session("UserName") = "David"
You can retrieve the value of the session object in any page the user visits on your site in the following way:
Response.Write( Session("UserName" ) );
You can remove session objects from the session state by using the Remove or RemoveAll method.
Session.Remove( "UserName" )
Session objects can store any kind of information and there is no restriction on the size of the data.