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

  • 相关阅读:
    单元测试
    python gdb
    圣诞树
    网络是怎样连接的 读书笔记
    POJ2104 K-th Number(整体二分)
    [SDOI2011]消耗战
    [HNOI2011]XOR和路径
    [HNOI2013]游走
    [JSOI2008]球形空间产生器
    POJ2728 Desert King
  • 原文地址:https://www.cnblogs.com/libbybyron/p/4125878.html
Copyright © 2011-2022 走看看