0

Session in asp.net is not expiring on expected time. Below is my part of web.config file for session configuration. Here i want to expire my session in 2 minutes and redirect the user to login page for test purpose. Here session expires about 6 to 7 minutes later.

<system.web>
    <sessionState mode="InProc" timeout="2" />
    <authentication mode="Forms">
          <forms loginUrl="/Home/Login" timeout="2" />
    </authentication>
</system.web>

Thanks.

Redone
  • 1,253
  • 5
  • 18
  • 37
  • Possibly same as http://stackoverflow.com/questions/648992/session-timeout-in-asp-net/650126#650126 – Alicia Jul 10 '13 at 08:29

1 Answers1

4

Make sure you have disabled sliding expiration:

<system.web>
    <sessionState mode="InProc" timeout="2" />
    <authentication mode="Forms">
          <forms loginUrl="/Home/Login" timeout="2" slidingExpiration="false" />
    </authentication>
</system.web>

Now no matter whether you are sending requests to the application during the period, the forms authentication cookie won't be renewed.

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928