ARV
ARV

Reputation: 1141

ASP.NET session timeout unexpectedly

I have an asp.net application in IIS 5.0(windows 2000 server), my application is working with windows authentication and I have set the timeout as 120 min. Say the user starts working from 11:00 and the user is working on the application but after about 2 hrs i.e. about 13:00 the session timeout unexpectedly even though user is working on it. I modified the timeout to 300 min now the session stays active for about 5hrs and disconnects unexpectdly even thow user is still working. I have the web.config file as below.

<authentication mode="Windows"/>
 <sessionState timeout="120">

also checked the asp.net session timeout in the virtual directory properties which is the same 120 min.

Any taught or solution will be very helpful.

Upvotes: 1

Views: 4571

Answers (4)

noob
noob

Reputation: 21

Had this same issue. My case wasnt the timout in sessionState

<sessionState mode="InProc" timeout="5" />

it was forms timeout

<authentication mode="Forms">
  <forms loginUrl="~/" slidingExpiration="true" timeout="5" />
</authentication>

I set the timeout in forms to 120(2 hours) and its working

<authentication mode="Forms">
  <forms loginUrl="~/" slidingExpiration="true" timeout="120" />
</authentication>

Upvotes: 1

ARV
ARV

Reputation: 1141

Timeout in my case was because the session was not ended properly when the user disconnects unexpectedly. When the user connects the next time this was causing some timeout problem. After closing the sessions properly it works fine

Upvotes: 1

Icarus
Icarus

Reputation: 63970

If you use InProc Session State mode, all session information can be lost at any time regardless of the timeout parameter if the application pool is recycled, which can happen at any time for different reasons.

I would change to one of the Out Of Proc Session State modes, if you can.

Check these links:

asp.net inproc vs out of proc performance

http://www.hanselman.com/blog/TroubleshootingExpiredASPNETSessionStateAndYourOptions.aspx

Upvotes: 2

Ivo
Ivo

Reputation: 3436

Did you check the application pool time out?

IIS -> application pools -> select pool -> Advanced settings -> section "process model" => Idle Time-out(minutes)

Upvotes: 0

Related Questions