private void Page_Load(object sender, System.EventArgs e)
	if (!IsPostBack)
		if (Request.Cookies["MuneebCookies"]!=null)
			HttpCookie httpCookie = Request.Cookies["MuneebCookies"];
			TextBox1.Text = httpCookie["FirstName"];
			TextBox2.Text = httpCookie["LastName"];

private void Button1_Click(object sender, System.EventArgs e)
	HttpCookie httpCookie = new HttpCookie("MuneebCookies");
	httpCookie.Values.Add("FirstName", TextBox1.Text);
	httpCookie.Values.Add("LastName", TextBox2.Text);
	httpCookie.Expires  = DateTime.Now.AddHours(2);
	// httpCookie.Expires  = DateTime.Now.AddYears(50);
	// NEVER EXPIRES (practically)

You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

AddThis Social Bookmark Button

Similar Posts

Comments are closed.