这是那些愚蠢的问题之一。答案应该很简单,但是似乎没有用。有人对我还有其他想法吗?
我要在单击按钮时添加cookie
var impersonationCookie = new HttpCookie("UserImp_ImpAuid");
impersonationCookie.Value = Encode64(auidToImpersonate);
impersonationCookie.Expires = DateTime.Now.AddDays(1d);
impersonationCookie.Path = "/";
Page.Response.Cookies.Add(impersonationCookie);
我要终止Cookie并清除page_load
上的值
HttpCookie currentUserCookie = HttpContext.Current.Request.Cookies["UserImp_ImpAuid"];
HttpContext.Current.Response.Cookies.Remove("UserImp_ImpAuid");
currentUserCookie.Expires = DateTime.Now.AddDays(-10);
currentUserCookie.Value = null;
HttpContext.Current.Response.SetCookie(currentUserCookie);
Chrome浏览器(v 69)仍显示值为MDAwMDM5OTk2
且有效期为When the browsing session ends
的cookie。
我尝试了其他问题的多种解决方法
答案 0 :(得分:1)