以下是我删除Cookie的代码:
HttpCookie c1 = HttpContext.Current.Request.Cookies["id"];
c1.Expires = DateTime.Now.AddDays(-1d);
c1.Value = "0";
Response.Cookies.Add(c1);
var test = Request.Cookies["id"].Value; //Test to check if cookie was deleted or at least changed the value.
HttpContext.Current.Response.Cookies.Clear();
HttpContext.Current.Session.Abandon();
现在当我调试这个并且到达var = test代码行时,cookie值等于0.这很好,但是当我移动到另一个页面时,突然所有的更改都被撤销,id cookie返回到它的最后一个值。我尝试刷新页面,但没有任何作用。 我只是不能摆脱这些饼干......