【发布时间】:2013-04-13 21:35:28
【问题描述】:
我使用以下文章创建了一个关于在 asp.net mvc2 应用程序中显示会话过期警告消息的 POC。 http://www.fairwaytech.com/2012/01/handling-session-timeout-gracefully/
我在代码中做了一处改动,如下所述:
location.href = expireSessionUrl;在endSession方法中改成如下代码:
window.location.replace(expireSessionUrl);
一旦用户单击“会话警告消息”对话框中的“注销”按钮,他就会导航到“注销”视图。但是在这里,如果他点击浏览器的后退按钮,他会被导航到上一页。
我有下面提到的修改过期方法:
[Authorize]
public virtual ActionResult Expire()
{
Session.Clear();
FormsService.SignOut();
HttpContext.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));
HttpContext.Response.Cache.SetValidUntilExpires(false);
HttpContext.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
HttpContext.Response.Cache.SetCacheability(HttpCacheability.NoCache);
HttpContext.Response.Cache.SetNoStore();
return Redirect(“/”);
}
请您指导我解决问题。
提前致谢 桑托什库马尔帕特罗
【问题讨论】:
标签: asp.net asp.net-mvc-2