private static void DetelteAllCookies(string domain)
{
if (HttpContext.Current.Request.Cookies["userToken"] == null)
{
string cookieName;
int limit = HttpContext.Current.Request.Cookies.Count;
for (int i = 0; i < limit; i++)
{
cookieName = HttpContext.Current.Request.Cookies[i].Name;
HttpContext.Current.Response.Cookies.Remove(cookieName);
HttpContext.Current.Response.Cookies[cookieName].Domain = domain;
HttpContext.Current.Response.Cookies[cookieName].Expires = DateTime.Now.AddDays(-1);
HttpContext.Current.Response.Cookies[cookieName].Value = null;
}
}
}
来源:https://www.cnblogs.com/libbybyron/p/4125878.html