概述
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
最后
以上就是耍酷白羊为你收集整理的清除cookie的全部内容,希望文章能够帮你解决清除cookie所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复