Tuesday, May 16, 2017

Cookies Implementation in ASp.NET

{
if(CheckBox1.Checked==true)
{
Response.Cookies["ASPNET2005"]["Name"]=txtName.Text;
Response.Cookies["ASPNET2005"]["Time"]=DateTime.Now.ToString();
Response.Cookies["ASPNET2005"].Expire=DateTime.Now.AddMonths(1);
}
}
//Button
{
if(Request.Cookies["ASPNET2005"]==null)
Label1.Text="There is no cookies";
else
Label1.Text=Request.Cookies["ASPNET2005']["Name"]+"&nbsp"+Request.Cookies["ASPNET2005"]["Time"];
}

No comments:

Post a Comment