简体   繁体   中英

How do you remove HttpOnly cookies?

如果我的应用程序将HttpOnly cookie放在客户端上,然后需要删除它们,你怎么能完全删除它们?

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM