Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 >

  • 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....

like image 514
Dennis Avatar asked Mar 09 '26 14:03

Dennis


2 Answers

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.

like image 194
Dennis Avatar answered Mar 11 '26 08:03

Dennis


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

like image 22
Icemanind Avatar answered Mar 11 '26 09:03

Icemanind