JQuery idleTimeout plugin: How to display the dialog after the session is timedout on ASP.NET MVC Pa
- by Rita
Hi
I am working on migrating the ASP.NET apllication to MVC Framework.
I have implemented session timeout for InActiveUser using JQuery idleTimeout plugin.
I have set idletime for 30 min as below in my Master Page. So that After the user session is timedout of 30 Min, an Auto Logout dialog shows for couple of seconds and says that "You are about to be signed out due to Inactivity"
Now after this once the user is logged out and redirected to Home Page. Here i again want to show a Dialog and should stay there saying "You are Logged out" until the user clicks on it.
Here is my code in Master page:
$(document).ready(function() {
var SEC = 1000;
var MIN = 60 * SEC;
// http://philpalmieri.com/2009/09/jquery-session-auto-timeout-with-prompt/
<% if(HttpContext.Current.User.Identity.IsAuthenticated) {%>
$(document).idleTimeout({
inactivity: 30 * MIN,
noconfirm : 30 * SEC,
redirect_url: '/Account/Logout',
sessionAlive: 0, // 30000, //10 Minutes
click_reset: true,
alive_url: '',
logout_url: ''
});
<%} %>
}
Logout() Method in Account Controller:
public virtual ActionResult Logout() {
FormsAuthentication.SignOut();
return RedirectToAction(MVC.Home.Default());
}
Appreciate your responses.