Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat is the impact of F5 loadbalancer on session timeout in an asp.net mvc2 app
    text
    copied!<p>I have implemented the showing alert message for Session timeout in an asp.net mvc2 application using the following article with some customization as per the requirement:</p> <p><a href="http://fairwaytech.com/2012/01/handling-session-timeout-gracefully/" rel="nofollow">http://fairwaytech.com/2012/01/handling-session-timeout-gracefully/</a></p> <p>along with the following session state mode:</p> <pre><code>&lt;sessionState mode="SQLServer" sqlConnectionString="Data Source=StudentsDB;User ID=xxxxxxx;Password=xxxxxxx;Integrated Security=False;MultipleActiveResultSets=True" allowCustomSqlDatabase="true" cookieless="false" timeout="30" compressionEnabled="true" sqlCommandTimeout="240" /&gt; </code></pre> <p>Forms timeout=15 and Sessiontimeout = 30</p> <p>The application is running fine in my development and devintegration environment(with no loadbalancer in both the environments.</p> <p>When I deployed the application in QA and Staging environment where there is F5 loadbalancer configuration available it started behaving weirdly.</p> <p>For some users the alert pop up comes and some other users it does not appear at all and sometimes it logs out automatically.</p> <p>The functionality is not running properly and behaving weird manner.</p> <p>There are no sticky sessions enabled on F5 loadbalancer.</p> <p>In Global.asax.cs file I have the following code :</p> <pre><code>protected void Application_PreRequestHandlerExecute(object sender, EventArgs e) { Only access session state if it is available if (Context.Handler is IRequiresSessionState || Context.Handler is IReadOnlySessionState) { //If we are authenticated AND we don't have a session here.. redirect to login page. HttpCookie authenticationCookie = Request.Cookies[FormsAuthentication.FormsCookieName]; if (authenticationCookie != null) { FormsAuthenticationTicket authenticationTicket = FormsAuthentication.Decrypt(authenticationCookie.Value); if (!authenticationTicket.Expired) { //of course.. replace ANYKNOWNVALUEHERETOCHECK with "UserId" or something you set on the login that you can check here to see if its empty. if (Session["IsSessionValid"] == null) { //This means for some reason the session expired before the authentication ticket. Force a login. FormsAuthentication.SignOut(); Response.Redirect(FormsAuthentication.LoginUrl, true); return; } } } } } </code></pre> <p>I tried to check the code and all the things on my devlopment and devintegration environment and found nothing much. Can anyone help me to know the possible reasons for the above mentioned issue?</p> <p>Thanks &amp; Regards, Santosh Kumar Patro</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload