Monday, August 27, 2012

READ AND WRITE COOKIES IN ASP.NET

 At Page load event


//////Read Cookie
 if(Request.Cookies["Cookiename"]!=null)
{
HttpCookie cok=new HttpCookie("Cookiename");
LblCookie.Text=cok.Value ;
}
//////



/////write cookie

HttpCookie cok=new HttpCookie("Cookiename");
cok.Value=txtUsername.Text;
Response.Cookies.Add(cok);



//////

0 comments:

Post a Comment