I am using this function to write a cookie:
private static void SaveCookie(stri ng CookieName, string CookieValue, bool
Persistent)
{
HttpContext.Cur rent.Response.C ookies[CookieName].Value = CookieValue;
HttpContext.Cur rent.Response.C ookies[CookieName].Path = "/";
HttpContext.Cur rent.Response.C ookies[CookieName].Domain =
ConfigurationSe ttings.AppSetti ngs["cookie_dom ain"].ToString();
if (Persistent) {HttpContext.Cu rrent.Response. Cookies [CookieName].Expires
= DateTime.Now.Ad dMonths(12);}
}
The cookie gets written correctly except that if I pass false to Persistent
(and Expires doesn't get set, I stepped through the code, I am sure of
that), the cookie is still persistent.(if I close the browser and re-open it
the cookie is still there).
I had similar code in traditional ASP and it was working fine. Is there a
step I am missing?
The default value of the Expires property appears to be {1/1/1}
PS: I am not using formsauthentica tion and I don't plan to do it.
Thanks!
--
Marco Rispoli - NJ, USA / PP-ASEL
My on-line aviation community -> http://www.thepilotlounge.com