Dennis
Dennis

Reputation: 1848

Asp.net session variable timeout

I'm using asp.net (.net 4.0) on iis6, and have a sessionvariable that is gone after about 20-30 mins.

I've tried everything I could find on the internet:

My web.config contains:

<sessionState mode="InProc" cookieless="false" timeout="120" />
<httpRuntime requestValidationMode="2.0" maxRequestLength="204800"
executionTimeout="3600" />
<forms loginUrl="/subsidies/inlog.aspx" name=".ASPXFORMSAUTH" timeout="120" />
<membership defaultProvider="MyMembershipProvider" userIsOnlineTimeWindow="121">

Machine:

c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Config\web.config

<system.web>
  <sessionState timeout="120" />

Application pool:

Recycle worker processes (in minutes) : 120

Shutdown worker processes after being idle for (time in minutes): 120

Website properties:

Connection timeout: 120 seconds

Home Directory > Configuration > Options > Application Configuration >

And still, a session variable is gone in about 20-30 minutes. Hopefully someone can help me....

Upvotes: 3

Views: 10445

Answers (2)

Dennis
Dennis

Reputation: 1848

I finally found the problem. It's fixed.

The problem was the Application Pool. On every recycle, the session was lost. So we did turn off the application pool recycling, and are scheduling the recycle once a day.

Upvotes: 2

Icemanind
Icemanind

Reputation: 48686

You seem to be using Forms Authentication. Be sure you have slidingExpiration set to False in your web.config.

Upvotes: 1

Related Questions