05.27.08
Passing data from one page to other in asp.net
1)Query String
2)Cookies
3)Sessions
ParentPage.aspx
——————-
Server.Transfer(”ChildPage.aspx?Name=” + txtName.Text);
//Using Response.Redirect
Response.Redirect(”ChildPage.aspx?Name=” + txtName.Text);
//Using Cookies
HttpCookie cName = new HttpCookie(”Name”);
cName.Value = txtName.Text;
Response.Cookies.Add(cName);
Response.Redirect(”ChildPage.aspx”);
//Using Sessions
Session["Name"] = txtName.Text;
Response.Redirect(”Childpage.aspx”);
ChildPage.aspx
—————-
//using Response.Redirect
if (Request.QueryString["Name"] != null)
Label1.Text = Request.QueryString["Name"];
//Using Cookies
if (Request.Cookies["Name"] != null)
Label1.Text = Request.Cookies["Name"].Value;
//Using Sessions
if (Session["Name"] != null )
Label1.Text = Session["Name"].ToString();