session expires when its in use

Why would a session expires in session expiry time even though user is active on the site? There is no app recycle or rebuild of code. Shouldn't it extend the expiry time whenever user navigates in the site? I use sessions to keep/check if user is logged in and after 20 minutes default time session expires regardless user being active or idle in the site
-1
asidana
5/4/2009 11:18:05 AM
📁 asp.net.state-management
📃 8807 articles.
⭐ 0 followers.

💬 9 Replies
👁️‍🗨️ 5742 Views



Hello,
If you have not web requests the application pool time out, so increase the application pool timeout in the IIS console. Most shared Windows Hosting companies reduced the app pool timeout to 5 minutes to save server resources.
Regards

Windows Hosting ASP.NET | Top ASP.NET Hosts | Dedicated Windows Hosting
-1
HostingASPNet
5/4/2009 12:11:10 PM

my problem is not immature timeout but timeout that doesn't get extended as user navigates and does request to/from server. Sessions gets lost when sessiontimout time has passed regardless. If i set it to 20 min they exprie in 20 min.
One note i must add is that i use Intelligencia.UrlRewriter
-1
asidana
5/4/2009 2:14:18 PM

asidana:
If i set it to 20 min they exprie in 20 min.

set slidingExpiration="true" in webconfig.. 
<authentication mode="Forms">
     forms name="userAuthentication" loginUrl="/Login.aspx" 
       enableCrossAppRedirects="true" path="/" domain="" slidingExpiration="true" timeout="30" />
 authentication></authentication>
 


My Blog


"Don't be afraid to be wrong; otherwise you'll never be right."
0
budugu
5/4/2009 2:23:24 PM
let me be more clear, my question is not related to any kind of login or auth method. im talking about a simple page and a sesion value in that page that expires in given time. default behevior for session values is not that, they get extended as user make requests to the server
0
asidana
5/4/2009 2:47:01 PM

Here are some other reasons for Session loss..
1.) IIS worker process restart or Application Pool recycle.(Check the System logs)
2.) Application Domain restart due to Antivirus scans or changes in Config files.
Changing the following files will cause restart of the application pool
  • web.config or machine.config
  • global.asax 
  • files in bin directory 

IIS worker process can get recycled depending on the configuration, low on virtual memory, crash due to unhandled exception etc..
Use Debug Diagnostics to find the problem..
http://www.iis.net/downloads/default.aspx?tabid=34&g=6&i=1286
or
http://www.microsoft.com/downloads/details.aspx?familyid=9BFA49BC-376B-4A54-95AA-73C9156706E7&displaylang=en


My Blog


"Don't be afraid to be wrong; otherwise you'll never be right."
-1
budugu
5/4/2009 2:57:35 PM

Session will be active only if you access Session object within 20 minutes. If you don't access Session object and if you keep on moving around pages withoug accessin Session object, Session will expire.
To make sure Session stays alive, access session object withing 20 minutes.

Please mark it as answer if it resolves the issue.

visit: http://technicalsol.blogspot.com
0
sumitd
5/4/2009 3:21:45 PM

sumitd:

Session will be active only if you access Session object within 20 minutes. If you don't access Session object and if you keep on moving around pages withoug accessin Session object, Session will expire.

To make sure Session stays alive, access session object withing 20 minutes.


Not 100% true.  As long as a page has not disabled session state, it will access the session automatically when requested.


My Blog


"Don't be afraid to be wrong; otherwise you'll never be right."
-1
budugu
5/4/2009 3:37:59 PM

I agree with you budugu.

Please mark it as answer if it resolves the issue.

visit: http://technicalsol.blogspot.com
0
sumitd
5/4/2009 3:58:15 PM

i haven't disabled session state
-1
asidana
5/4/2009 4:38:13 PM
Reply: