Question

If my application places HttpOnly cookies on a client and then needs to remove them how can you remove them completely?

Was it helpful?

Solution

You can cause the cookie to expire when the user visits your website, for example:

HttpCookie expiredCookie = new HttpCookie(cookieName);
expiredCookie.Expires = DateTime.UtcNow.AddDays(-1);
Response.Cookies.Add(expiredCookie);

You'll have to do this for every cookie you want to be removed.

OTHER TIPS

You can't reach out and delete cookies. You can take all the cookies, wipe out the data and make them expired though.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top