June 9, 2011

Insert and read data from Cookie in ASP.Net

HttpCookie Abc = new HttpCookie("xyz");

Abc.value = "TestVal";
Abc.Expires = Datetime.Now.Addseconds(20);
Response.Cookies.Add(Abc);

Read value From Cookies

string cookieVal = Request.Cookies["xyz"];

No comments:

Post a Comment