protected void btnSubmit_Click(object sender, EventArgs e) { HttpCookie testCookie = new HttpCookie("TestCookie"); testCookie.Path = "/"; testCookie.Expires = Convert.ToDateTime("March 14 2000"); testCookie.Value = "Nikhil Agarwal"; Response.SetCookie(testCookie); HttpCookie testCookieValue = new HttpCookie("TestCookie"); if (testCookieValue != null) { Response.Write(testCookieValue.Value.ToString()); } }