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

  • 相关阅读:
    php配置GD库
    Linux 安装 Apache2+php5+gd+freetype2
    gd库
    数组和链表的区别
    python 整数中1出现的次数
    python栈--字符串反转,括号匹配
    Linux基础知识
    操作系统
    后台面试问题
    python 面向对象
  • 原文地址:https://www.cnblogs.com/wucf2004/p/1266076.html
Copyright © 2011-2022 走看看