我有一个MVC应用程序,当点击浏览器Back
按钮时,我可以在浏览器历史记录中导航。
我有以下MVC代码来构建链接:
@Ajax.ActionLink("Page1", "Index","Page1",new AjaxOptions { HttpMethod = "GET", InsertionMode = InsertionMode.Replace, UpdateTargetId= "mainAjax", LoadingElementId="loader", OnComplete="ChangeUrl('Page1');" })
@Ajax.ActionLink("Page2", "Index", "Page2", new AjaxOptions { HttpMethod = "GET", InsertionMode = InsertionMode.Replace, UpdateTargetId = "mainAjax", LoadingElementId = "loader", OnComplete = "ChangeUrl('Page2');" })
@Ajax.ActionLink("Page3", "Index", "Page3", new AjaxOptions { HttpMethod = "GET", InsertionMode = InsertionMode.Replace, UpdateTargetId = "mainAjax", LoadingElementId = "loader", OnComplete = "ChangeUrl('Page3');" })
@Ajax.ActionLink("Page4", "Index", "Page4", new AjaxOptions { HttpMethod = "GET", InsertionMode = InsertionMode.Replace, UpdateTargetId = "mainAjax", LoadingElementId = "loader", OnComplete = "ChangeUrl('Page4');" })
这是一个JavaScript
来处理历史上的回归:
$(document).ready(function () {
$(window).bind('popstate', function () {
window.location.href = window.location.href;
});
});
function ChangeUrl(url)
{
document.title = $('.pageTitle').text() + ' - eSite'
window.history.pushState(null, null, url);
}
但是,当返回login
页面时,点击Forward
按钮后,我就可以在未经过身份验证的情况下返回应用程序。
我可以做什么,因此当浏览器的历史记录回到Login
页面时,用户已退出并且他的会话已被放弃?