How to create a permenent cookie

Showing Answers 1 - 3 of 3 Answers

teak

  • Apr 26th, 2006
 

HttpCookie myCookie = new HttpCookie("uname","teak");myCookie.expiry = DateTime.Now.AddYear(1);Response.Cookie.Add(myCookie);

  Was this answer useful?  Yes

The permanent cookie is created the same way the normal cookie is created. To create a permanent cookie you have to specify a date in the future. Like,oHeader.AddCookie('userid',lcID,'/wconnect','NEVER') where NEVER is converted to a date in future.

  Was this answer useful?  Yes

florinr

  • Apr 28th, 2006
 

HttpCookie l_objCookie = new HttpCookie("myCokie", "myValue");

l_objCookie.Expires = DateTime.MaxValue;

Response.Cookies.Add(l_objCookie);

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions