Session Expire (edit)

Anh Bùi Hải (Wize Solutions)

Session Expires

https://cbertolasio.wordpress.com/2010/11/28/recap-on-expired-sessions-and-idle-users-in-asp-net-mvc/

https://cbertolasio.wordpress.com/2010/11/27/using-an-actionfilter-to-redirect-to-login-when-session-expires/

https://cbertolasio.wordpress.com/2010/11/28/dealing-with-idle-clients-and-expiring-sessions-in-asp-net-mvc/

https://cbertolasio.wordpress.com/2010/11/28/using-an-actionfilter-to-redirect-to-login-when-session-expires-part2/

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

https://cbertolasio.wordpress.com/2010/11/28/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)

https://forums.asp.net/t/1952999.aspx?Session+is+kept+idle+on+client+post+backs+and+raising+session+expiry+warning+in+asp+net+MVC+web+application

@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>
}