1

I am trying to use aspx anonymousIdentification, but I ran into a problem.

How can I make the cookie go away, disappear, die, when the browser is closed?

I know I can manually, with some code, get rid of it (user clicks on log off, or on a browser close event), but that is not suficient.

Any help would be appreciated. This is the tag in the web.config file:

<anonymousIdentification enabled="true" cookieName=".Blahblah" cookieTimeout="99999" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="All" cookieless="UseCookies" domain=".domain.com" />

Thank you!

Naner
  • 1,292
  • 6
  • 25
  • 43
  • See [this](http://stackoverflow.com/questions/1783302/clear-cookies-on-browser-close) post on how to clear cookies upon closing a browser window. – m1kael May 30 '12 at 14:26
  • Thanks for your response. But it did not solve my problem. Changing the Expires property of the Cookie caused the cookie to stop working. I also tried changing the value on CookieTimeout to 0, but then the application crashed because that value is required. – Naner May 30 '12 at 14:50
  • Can you explain why it is insufficient to remove the cookie when the browser is closed? – Joshua Drake May 30 '12 at 14:52
  • Additionally, you should accept ThomasM's [answer](http://stackoverflow.com/a/9132219/19308) to your [Javascript question](http://stackoverflow.com/q/9132048/19308). – Joshua Drake May 30 '12 at 14:59
  • Well... My concern is: what would happen if the user's browser crashes and they have to kill the process (iexplore.exe). If that happens, I am unable to call any events or the user will not be able to click on a log off button. – Naner May 30 '12 at 15:01
  • Answer accepted. Thanks for the reminder. – Naner May 30 '12 at 15:02
  • Now... also... I am not finding a way to delete the cookie. I tried:HttpCookie aCookie; string cookieName; int limit = Request.Cookies.Count; for (int i=0; i – Naner May 30 '12 at 16:44
  • Found what I needed to delete the cookies, I had to set the domain value for a fake cookie to overwrite it. But I still can't find a way to delete it when the browser is closed... – Naner May 30 '12 at 17:41

0 Answers0