跨域删除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);
           }
       }

原文地址:https://www.cnblogs.com/wucf2004/p/1266076.html