Answered by:
My asp.net application session automatically expired why.....????

Question
-
User-304920254 posted
Dear,
My asp.net web application session automatically expired in unexpected time on live server what is the problem?
Thursday, October 6, 2016 10:40 AM
Answers
-
User-484054684 posted
If your application is deployed in the Server - check with server team who is maintaining it.. to see if they have overwritten these values in their root web.config or machine.config files. Ignore my comment above (striked out) - web.config will have higher importance and will overwrite the settings if you have explicitly mentioned the settings in your config.
You can still check with server team to see the Event Logs in the server to see if the application is getting recycled during that interval.
To open the event logs - you can click Windows button + R (i.e., open run command) - Type eventvwr and press enter - That would open the GUI to see event logs.
I would also check the Idle time out setting of AppPool. (Chris has put the screenshot as well in the post above).
For complete steps:
1. Open IIS, Locate your site.
2. Check Advanced settings to findout the application pool.
3. Click on Application pools in the left hand pane and then you can see list of application pools on the center pane. Select your application pool. Go to Advanced settings in the right hand pane. This is where you can see the idle timeout setting (named as `Idle Time-out (minutes)`) and you can change it, if it is 5 over there.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, October 10, 2016 10:20 AM
All replies
-
User-484054684 posted
There could be many reasons for it.
One of the reasons could be if there is any restart in IIS or appPool recycle (could be due to a web.config change or so) on the server.
This article explains the list of common causes:
http://www.c-sharpcorner.com/uploadfile/technoNet/session-timeouts-causes-and-remedies/
Thursday, October 6, 2016 11:52 AM -
User-304920254 posted
sir how we can change IIS or appPool recycle setting on live server please tell me sir I am new in asp.net.
Thursday, October 6, 2016 12:25 PM -
User-484054684 posted
App pool get recycled only when the changes happens or some unexpected things happen on server (causes can vary - hope you read the blog).
So first we need to figure ask few questions to ourselves to find out the root cause of the problem:
when did the session expire?
Is it happening frequently (or) just happened once for one user?
If it is happened only once for a user - what is the timestamp of the error occured? - With the timestamp we can look for any event logs in the server to see what happened during that time.
If it is happening frequently - what is the time that the user is getting logged out? In general, 20 minutes idle time would be the session timeout as defined in the web.config file - If the user session expired after 20 minutes of idle time (assuming slidingExpiration setting), then, it is usual behaviour and not an issue.
Hope this helps. Let me know for any questions on these.
Thursday, October 6, 2016 2:24 PM -
User-304920254 posted
sir when user left application idle for 5 min it will logout automatically otherwise I have check for 1.5 hour on continue using it works fine. It is happening frequently.
Friday, October 7, 2016 4:31 AM -
User-2057865890 posted
Hi Danishdotnet,
Make sure idle timeout of the Application Pool is longer than the .NET session timeout. Idle Timeout is if no action has been asked from your web app, the process will drop and release everything from memory.
Best Regards,
Chris
Friday, October 7, 2016 7:36 AM -
User-484054684 posted
In addition to app pool recycle that we discussed earlier, Make sure the session timeout is also set correctly in web.config (in case if you have overwritten it).
<configuration> <system.web> <sessionState mode="InProc" cookieless="true" timeout="30" /> </system.web> </configuration>
In the setting above, timeout="30" means, 30 minutes.
Hope in your config file, it is not set to 5.
Reference for timeout: https://msdn.microsoft.com/en-us/library/system.web.sessionstate.httpsessionstate.timeout(v=vs.110).aspx
Friday, October 7, 2016 9:31 AM -
User-304920254 posted
Can anyone help me for this problem I am in a big problem by this condition. My web application automatically logout after 5 -6 min.
<configuration> <system.web> <sessionState mode="InProc" cookieless="true" timeout="30" /> </system.web> </configuration>
This is also not working.
<authentication mode="Forms"> <forms timeout="6000"/> </authentication> <sessionState timeout="6000" />
This is also not working. what can I do????????
Saturday, October 8, 2016 9:24 AM -
User-484054684 posted
If your application is deployed in the Server - check with server team who is maintaining it.. to see if they have overwritten these values in their root web.config or machine.config files. Ignore my comment above (striked out) - web.config will have higher importance and will overwrite the settings if you have explicitly mentioned the settings in your config.
You can still check with server team to see the Event Logs in the server to see if the application is getting recycled during that interval.
To open the event logs - you can click Windows button + R (i.e., open run command) - Type eventvwr and press enter - That would open the GUI to see event logs.
I would also check the Idle time out setting of AppPool. (Chris has put the screenshot as well in the post above).
For complete steps:
1. Open IIS, Locate your site.
2. Check Advanced settings to findout the application pool.
3. Click on Application pools in the left hand pane and then you can see list of application pools on the center pane. Select your application pool. Go to Advanced settings in the right hand pane. This is where you can see the idle timeout setting (named as `Idle Time-out (minutes)`) and you can change it, if it is 5 over there.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, October 10, 2016 10:20 AM