I have an MVC 3 site with a session timeout of 2 minutes.
If the user doesn\'t interact with the page within 2 minutes, they should be automatically forwarded to the
var checkTimeout;
$(document).ready(function () {
checkTimeout = setTimeout(checkSession, 900000);
});
function checkSession() {
$.ajax({
url: "/Account/CheckIfSessionValid",
type: "POST",
success: function (result) {
if (result == "False") {
window.location = "/Account/LogOff";
}
},
complete: function () {
setupSessionTimeoutCheck();
}
});
}
function setupSessionTimeoutCheck() {
clearTimeout(checkTimeout);
checkTimeout = setTimeout(checkSession, 900000);
}