zoukankan      html  css  js  c++  java
  • 清除cookie


        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;
                }
            }
        }

  • 相关阅读:
    linux脚本mysql服务与keepalived服务高可用脚本
    linux脚本启动服务脚本
    linux脚本数据库备份脚本
    linux脚本清理日志文件脚本
    最大数字
    求阶乘
    素数
    水仙花数
    js基础1
    css常用属性2
  • 原文地址:https://www.cnblogs.com/libbybyron/p/4125878.html
Copyright © 2011-2022 走看看