For transferring data from one page to another page or through out entire application in asp.net, there are different different way.
1) Using Sessions
2) Using Cookies
3) Using QueryString
1) Using Session SessionInfo[^]
you can store simple as well as Complex data to session object, session will maintain server side.
Session["SESSIONNAME"] = value;
e.g.
Session["USER_NAME"] = "Tejas Vaishnav";
string _userName = Session["USER_NAME"].toString();
2) Using Cookie CookieInfo[^]
Cookie is a small text file used to store data client side.
HttpCookie _cookie = new HttpCookie("COOKIE NAME");
_cookie["COOKIE NAME"] = "Value";
Response.Cookies.Add(_cookie);
HttpCookie _cookieValue = Request.Cookies["COOKIE NAME"];
string _name = _cookieValue["COOKIE NAME"].toString();
e.g.
HttpCookie _cookie = new HttpCookie("USER_NAME");
_cookie["USER_NAME"] = "Tejas Vaishnav";
Response.Cookies.Add(_cookie);
HttpCookie _cookieValue = Request.Cookies["USER_NAME"];
string _userName = _cookieValue["USER_NAME"].toString();
3) Using QueryString QueryStringInfo[^]
Query string is a collection of Key and value pair passed through your page URL.
Response.Redirect("~/Default.aspx?name=tejas&lastName=vaishnav");
http:
string _name = Request.QueryString["Name"].toString();
string _lastName = Request.QueryString["LastName"].toString();
these all the way you can pass data from one page to another page.