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
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.
I’ve tried plenty of variations from other questions
- Delete a cookie on signing out
- How to delete a cookie from .net
- How to delete cookies on an asp.net website
Here is Solutions:
We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.
As mentioned in the comment, This could be because chrome setting “Continue where you left off”.
You can cross check in a different browser.
Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂