Session Expire (edit)
Anh Bùi Hải (Wize Solutions)
Session Expires
Display Session Expires
http://www.intstrings.com/ramivemula/articles/display-session-expire-popup-in-asp-net-mvc/
Dealing with Idle Clients and Expiring Sessions in ASP.NET MVC
Handling Session and Authentication Timeouts in ASP.NET MVC
https://markfreedman.com/handling-session-and-authentication-timeouts-in-asp-net-mvc/
Session is kept idle on client post backs, and raising session expiry warning in ASP.NET MVC Web Application (HAY)
@section Scripts {
<script type="text/javascript">
var totalTimeOut = 0;
var sessionTimeout = @Session.Timeout;
sessionTimeout *= 60;
totalTimeOut = sessionTimeout;
function ShowTime() {
$("#timeOut").text(sessionTimeout);
sessionTimeout -= 10;
if (sessionTimeout >= 10) {
//TODO
}
else {
alert("Session will be over!");
//TODO
}
if (sessionTimeout <= 0) {
clearInterval(interneal);
}
}
//If use the ajax (e.g. Jquery ajax) to call the server anywhere, this function should be call
function ResetTimeOut() {
sessionTimeout = totalTimeOut;
}
var interneal = window.setInterval("ShowTime()", 10000);
</script>
}