Create 2 webforms webform1 & webform2
In webform1 --->webform1.aspx
Name -> textbox
Email ->textbox
[go to webform2] <--- button
In webform2 --->webform2.aspx
Name -> label
Email ->label
click webform1 button.control
protected void Button1_Click(object sender, EventArgs e)
{
HttpCookie cookie = new HttpCookie("UserInfo");
Cookie["Name"]=txtName.Text;
Cookie["Email"]=txtEmail.Text;
Response.Cookies.Add(Cookie);
Response.Redirect("WebForm2.aspx");
-----------webform2.aspx.cs-------------
protected void Page_Load(object sender, EventArgs e)
{
HttpCookie cookie = new HttpCookie["UserInfo"];
if(cookie!=null)
{
lblName.Text=cookie["Name"];
lblEmail.Text=cookie["Email"];
}
}
//and then run webform1
Comments
Post a Comment