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.

1

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.