I have an MVC application and when clicking on the browser Back button, I'm able to navigate in browser history.
I have the following MVC code to build the links:
@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');" })
And this is a JavaScript to handle the going back in the history:
$(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);
}
However, when going back to login page, once I click Forward button, I'm able to get back to the application without being authenticated.
What can I do, so the user's is signed out and his session is abandoned when browser's history is back to Login page?