C# 跨域清除写入Cookie

/清除写入cookie
        public void deleteCookie()
        {
            HttpCookie acookie = HttpContext.Current.Request.Cookies["Username"];
            if (acookie != null)
            {
                acookie.Expires = DateTime.Now.AddDays(-20);
                acookie.Domain = ".zgbfw.com";
                HttpContext.Current.Response.AppendCookie(acookie);
            }

            HttpCookie acookie1 = HttpContext.Current.Request.Cookies["Userpass"];
            if (acookie1 != null)
            {
                acookie1.Expires = DateTime.Now.AddDays(-20);
                acookie1.Domain = ".zgbfw.com";
                HttpContext.Current.Response.AppendCookie(acookie1);
            }

        }

你可能感兴趣的:(C#)