1

How should I use the tag in the web.config in my MVC4 application, framework 4.0?

I added it in the web config like this:

<sessionState timeout="15"  />

but it didn't time out.

Also I can't understand for certain what it means if I set mode="StateServer" or mode="InProc" In the msdn it say about "InProc" - "Session state is in process with an ASP.NET worker process." But I don't know how to understand it and which one to choose.

Thank you.

1
  • How did you determine it doesn't time out? Commented Nov 6, 2014 at 15:27

2 Answers 2

1

configure it in the web.config:

<authentication mode="Forms">
    <forms defaultUrl="~/Default.aspx"
        loginUrl="~/Login.aspx"
        slidingExpiration="true"
        timeout="60" />
</authentication>

With the configuration above, the user will be always redirected to the Login.aspx page when their session expires. There is a timeout of 60 minutes, and sliding expiration means that the timeout is extended each time the user makes a request to the web application, so if he stays active the session will not expire. A configuration like this gives you another advantage over what you tried to do - once the user logs in he will be automatically redirected back to the resource he originally requested. And you can always override and customize this behavior.

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

Comments

0

Please take a look at this session timeout post to clarify how the timeout works and why it may not have for you.

Regarding what the different modes mean you can visit Session-State Modes

1 Comment

Thank you very much for your reply. I already know the stuff you showed me. So maybe I am not askign my question correctly.

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.