How do I clean out all cookies?
asp-classic
Solution
Daniel K is correct, expiring the cookie is the best option, Your question says you want to clear ALL cookies, you can do this via the Response object:
For Each cookie in Response.Cookies
Response.Cookies(cookie).Expires = DateAdd("d",-1,now())
Next
The problem with setting the cookie to "" - strictly speaking the cookie would still exist, if you want to expire them all so the browser discards them, use .expires
Problem
I am looking for the best way to clean/clear all existing cookies when they visit the website and are not authenticated. We don't allow client the ability to 'remember me' to stay logged in. So when they do visit again, what is the best way to start fresh with cookies? Is it to set all cookies to an empty string? Is it to set the date of the cookies to yesterday? Any example would be much appreciated.