Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you remove HttpOnly cookies?

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

like image 964
Chris Marisic Avatar asked Oct 07 '10 22:10

Chris Marisic


1 Answers

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.

like image 152
Waleed Eissa Avatar answered Sep 20 '22 15:09

Waleed Eissa