Skip to content
This repository was archived by the owner on Nov 20, 2018. It is now read-only.

ResponseCookies.Delete Not Deleting #565

Closed
eriksendc opened this issue Feb 17, 2016 · 3 comments
Closed

ResponseCookies.Delete Not Deleting #565

eriksendc opened this issue Feb 17, 2016 · 3 comments

Comments

@eriksendc
Copy link

Hi All,

When signing out of our web application we're wanting to clear a cookie that's set during their use of the application. The weird thing is that

Response.Cookies.Delete("searchCriteria");

doesn't clear the cookie, but

Response.Cookies.Delete("searchCriteria", new CookieOptions() { Expires = DateTime.Now.AddDays(-1) });

does. If I set a break point right after the call to Delete(), in both cases it looks like the expiration of the cookie is set to something significantly old (January 1 1970) - so my passing in Expires = ... doesn't do anything.

I looked at ResponseCookies.cs and can't really reason this out (but it's been a long day and maybe I'm just not seeing the issue). Anyways, I'd have thought we'd want the expiration (set way at the bottom of ResponseCookies.cs to make the cookie go bye bye.

Thanks,
Brian Eriksen

@Tratcher
Copy link
Member

Sounds like #437, which was fixed in RC2. The difference is that Delete("Cookie") wasn't setting Path=/, but `Delete("Cookie", options) does.

@eriksendc
Copy link
Author

I agree. Sorry, I tried to search around but didn't find 437. Am I allowed to mark this as a dupe and/or close it?

@Tratcher
Copy link
Member

Yes

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants