Reputation:
I am using iis6 to deploy my application. No matter how i change the timeout in iis configuration or i add a global.asax file to set Session.Timeout, or even used a sessionstate, im still getting session timeout after 20minutes, this is crazy! anyone please help me? i am so stuck..
web.config:
<authentication mode="Forms">
<forms name="__authcookie" loginUrl="LoginPage.aspx" timeout="60" protection="All" requireSSL="false" slidingExpiration="true" cookieless="UseDeviceProfile" enableCrossAppRedirects="false"/>
</authentication>
<sessionState mode="InProc" timeout="60" customProvider="AppFabricCacheSessionStoreProvider"></sessionState>
<membership>
<providers>
<clear />
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
</providers>
</membership>
<profile>
<providers>
<clear />
<add name="AppFabricCacheSessionStoreProvider" type="Microsoft.ApplicationServer.Caching.DataCacheSessionStoreProvider" cacheName="NamedCache1" sharedId="SharedApp"/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
</providers>
</profile>
Upvotes: 4
Views: 22145
Reputation: 2294
I have been struggling with this issue recently. There seems to be a variety of places that you can set timeout but your timeout will only be as long as the attribute with the shortest setting. Here are some of the things I have discovered ...
As everyone suggests check the "timeout" attribute of the "sessionState" node in the web.config file. This value can be edited either directly in the web.config file or through IIS configuration as @Romil describes above (although the UI has changed in later versions of IIS the setting is similiar).
If you are implementing Forms authentication then there is an additional timeout setting defined in the web.config file for that as well. Look for the ... system.web > authentication > forms node in the web.config and modify the "timeout" attribute to the desired minutes there as well.
Here's the one that I overlooked ... in IIS (verion 7.5 for sure, maybe earlier but I can't confirm) right click on the associated Application Pool and select "Advanced Settings". Under the heading "Process Model" (expand if neccessary) look for the setting "Idle Time-out (minutes)". Set this to the desired timeout in minutes. -- Explanation: While the sessionState > timeout setting affects the expiration of the cookie which stores your session ID in the browser, this timeout actually dictates when the worker process (that has not been used) should shut down. Once the process shuts down it no longer recalls existing Session ID's, so the ID in your browser cookie is no longer useful.
I hope that this is helpful to someone out there. This issue drove me crazy for hours and I am really surprised at how little information is out there about this, beyond setting the sessionState setting.
Good Luck, G
Upvotes: 7
Reputation:
Romil answers do work, the way i did was i only change the session timeout of the application but not the idle timeout. Now after extending from 20 to 60mins the way he showed, it works!
Upvotes: 0
Reputation: 20775
Include this in you web.config file:
using web.config
<sessionState timeout="minutes"/>
Using IIS
Change the following time-outs in Internet Services Manager .Choose a value greater than the default of 20.
Select Default Web Site > Properties > Home Directory > Application Settings > Configuration > Options.
Enable the session state time-out and set the Session timeout for 60 minutes.
Select Application Pools > DefaultAppPool > Properties.
From the Performance tab under Idle timeout, set Shutdown worker processes after being idle for a value higher than 20.
The default session time-out setting on IIS is 20 minutes but it can be increased to a maximum of 24 hours or 1440 minutes.
Upvotes: 6