ASP.NET
Programming and Technical
How do you create a permanent cookie?
Read Solution (Total 1)
-
- //create a cookie
HttpCookie myCookie = new HttpCookie("myCookie");
//Add key-values in the cookie
myCookie.Values.Add("userid", objUser.id.ToString());
//set cookie expiry date-time. Made it to last for next 12 hours.
myCookie.Expires = DateTime.Now.AddHours(12);
//Most important, write the cookie to client.
Response.Cookies.Add(myCookie); - 10 years agoHelpfull: Yes(4) No(0)
ASP.NET Other Question