假设OnResultExecuted()
中已实施BaseController
。
现在假设我有
View
我在其上呈现 4Actions
(每个 制作一个ajaxRequest)。
问题:
1.如何执行OnResultExecuted()(按什么顺序)?
2.是同步还是异步?
3.如果我以这种方式删除cookie:
protected override void OnResultExecuted(ResultExecutedContext filterContext)
{
// Some checks, that assure the cookie existence.
filterContext.HttpContext.Response.Cookies.Remove(FormsAuthentication.FormsCookieName);
//** BREAKPOINT **
// Create new cookie.
var cookie = new HttpCookie(FormsAuthentication.FormsCookieName, "my cool encrypted data");
cookie.Expires = DateTime.Now.AddHours(2);
filterContext.HttpContext.Response.Cookies.Add(cookie);
base.OnResultExecuted(filterContext);
}
- 然后浏览器检查工具会显示在** BREAKPOINT **?
- 在这4个ajax请求的第二次请求中,cookie仍然存在(不是在页面刷新之后)吗?
非常感谢。