zoukankan      html  css  js  c++  java
  • 跨域删除cookie的问题

    //参考别人的方法

    HttpCookie MyCo;
            string _strPageDomain="test.cn";
           if (_strPageDomain != null && _strPageDomain != "")
           {
               MyCo = HttpContext.Current.Request.Cookies["siteinfo"];
               if (System.Web.HttpContext.Current.Request.ServerVariables.ToString().IndexOf(_strPageDomain)>= 0 && MyCo != null)
               {
                   MyCo.Domain = _strPageDomain;
                   MyCo.Expires = DateTime.Now.AddHours(-24); //关键是这一句
                   HttpContext.Current.Response.Cookies.Add(MyCo);
               }
           }
           else
           {
               MyCo = HttpContext.Current.Request.Cookies["siteinfo"];
               if (MyCo != null)
               {
                   MyCo.Expires = DateTime.Now.AddHours(-48);                
                   HttpContext.Current.Response.Cookies.Add(MyCo);
               }
           }

  • 相关阅读:
    2016.7.17
    2016.7.16
    2016.7.15
    2016.7.12
    2016.7.11
    2016.7.10
    coco2d-x中的坐标系问题
    cocos2d-x中的Tiled地图
    cocos2d-x中的Box2D物理引擎
    python文件处理及装饰器
  • 原文地址:https://www.cnblogs.com/wucf2004/p/1266076.html
Copyright © 2011-2022 走看看