0
votes

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.

1

1 Answers

4
votes

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.