1

This is one of those dumb questions. The answer should be simple, but it doesn't seem to be working. Anyone have any ideas where else for me to look for some rep?

I'm adding a cookie on a button click

var impersonationCookie = new HttpCookie("UserImp_ImpAuid");
impersonationCookie.Value = Encode64(auidToImpersonate);
impersonationCookie.Expires = DateTime.Now.AddDays(1d);
impersonationCookie.Path = "/";
Page.Response.Cookies.Add(impersonationCookie);

I'm expiring a cookie and clearing the value on a page_load

HttpCookie currentUserCookie = HttpContext.Current.Request.Cookies["UserImp_ImpAuid"];
HttpContext.Current.Response.Cookies.Remove("UserImp_ImpAuid");
currentUserCookie.Expires = DateTime.Now.AddDays(-10);
currentUserCookie.Value = null;
HttpContext.Current.Response.SetCookie(currentUserCookie);

Chrome (v 69) still shows the cookie with the value MDAwMDM5OTk2 and with an expiration date of When the browsing session ends.

enter image description here

I've tried plenty of variations from other questions

w00ngy
  • 1,646
  • 21
  • 25
  • 1
    https://stackoverflow.com/questions/10617954/chrome-doesnt-delete-session-cookies – Girish Sep 23 '18 at 06:12
  • did you tried on different browser? – Girish Sep 23 '18 at 06:14
  • @mjwills - Appreciate the recommendation, but didn't seem to work. I think I've tried this before as well. – w00ngy Sep 23 '18 at 12:34
  • @Girish No I hadn't tried another browser. Tried Firefox just now and it looks like it worked no problem. And thanks for the link on the explanation. Makes sense. If you wanted to put this as the answer I'll confirm/accept Monday. – w00ngy Sep 23 '18 at 12:46

1 Answers1

1

As mentioned in the comment, This could be because chrome setting "Continue where you left off".

You can cross check in a different browser.

Chrome Doesn't Delete Session Cookies

w00ngy
  • 1,646
  • 21
  • 25
Girish
  • 166
  • 1
  • 2
  • 13
  • if this is the case, any idea why the expiry date and value haven't been udpated? I would expect Chrome to at least reflect that the expiration date has changed and the value to be cleared out. – w00ngy Sep 24 '18 at 12:05