Asp.net session variable timeout

asp.netsession-statesession-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 >

  • x Enable session state (enabled)
  • Session timeout: 120 minutes

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

Best Answer

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.

Related Topic