using System;using System.Data;using System.Configuration;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using System.Net; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { HttpCookie cookie = Request.Cookies["pref"]; if (cookie == null) { Label1.Text = "Un known Customer"; } else { Label1.Text = "Welcome " + cookie["name"]; } } protected void Button1_Click(object sender, EventArgs e) { HttpCookie cookie = Request.Cookies["pref"]; if (cookie == null) { cookie = new HttpCookie("pref"); } cookie["name"] = TextBox1.Text; cookie.Expires = DateTime.Now.AddMonths(5); Response.Cookies.Add(cookie); Label1.Text = "New customer" + cookie["name"]; }}