尝试过
if (Request.Cookies["IsGuest"] != null)
{
Response.Cookies["IsGuest"].Expires = DateTime.Now.AddDays(-1);
//HttpCookie myCookie = new HttpCookie("IsGuest");
//myCookie.Expires = DateTime.Now.AddDays(-1d);
//Response.Cookies.Add(myCookie);
}
string a = Request.Cookies["IsGuest"].Value;
我也尝试了通过注释未注释的代码和取消注释已注释的代码,但是...
string a = Request.Cookies["IsGuest"].Value;
始终运行且 Request.Cookies["IsGuest"]
从未为 null