Session Timeout
-
Dear all, I have the following configuration for my sessionState:
>
It works fine, but there is one thing i don't understand. When i open multiple tabs, all tabs have the same SessionID, but they don't time out at same time. I thought that all tabs share the same session, so they have to have also the same timeout :zzz: What i want is that ofter session timeout occurs, to logout the user from all opened tabs at the same time. But in my situaion, when two tabs are open, the first one logs the user out, but not from the second tab. On the second tab, the user still can work. This is my code to logout and redirect the user ofter session timeout:
protected void Session_Start(object sender, EventArgs e)
{
if (Context.Session != null)
{
if (Context.Session.IsNewSession)
{
string sCookieHeader = Request.Headers["Cookie"];if ((null != sCookieHeader) && (sCookieHeader.IndexOf("ASP.NET\_SessionId") >= 0)) { //signout the user and redirect to the login page FormsAuthentication.SignOut(); HttpContextBase httpContext = new HttpContextWrapper(HttpContext.Current); UrlHelper urlHelper = new UrlHelper(new RequestContext(httpContext, new RouteData())); string redirectUrl = urlHelper.Action("LogOn", "Account"); httpContext.Response.Redirect(redirectUrl); } } } }
How can i solve this issue? Thanks in advance.
-
Dear all, I have the following configuration for my sessionState:
>
It works fine, but there is one thing i don't understand. When i open multiple tabs, all tabs have the same SessionID, but they don't time out at same time. I thought that all tabs share the same session, so they have to have also the same timeout :zzz: What i want is that ofter session timeout occurs, to logout the user from all opened tabs at the same time. But in my situaion, when two tabs are open, the first one logs the user out, but not from the second tab. On the second tab, the user still can work. This is my code to logout and redirect the user ofter session timeout:
protected void Session_Start(object sender, EventArgs e)
{
if (Context.Session != null)
{
if (Context.Session.IsNewSession)
{
string sCookieHeader = Request.Headers["Cookie"];if ((null != sCookieHeader) && (sCookieHeader.IndexOf("ASP.NET\_SessionId") >= 0)) { //signout the user and redirect to the login page FormsAuthentication.SignOut(); HttpContextBase httpContext = new HttpContextWrapper(HttpContext.Current); UrlHelper urlHelper = new UrlHelper(new RequestContext(httpContext, new RouteData())); string redirectUrl = urlHelper.Action("LogOn", "Account"); httpContext.Response.Redirect(redirectUrl); } } } }
How can i solve this issue? Thanks in advance.