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.

dillci
  • 65
  • 2
  • 10

2 Answers2

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.

Bhaumik Shah
  • 382
  • 2
  • 8
  • 20
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

Community
  • 1
  • 1
Jerode
  • 490
  • 4
  • 15
  • Thank you very much for your reply. I already know the stuff you showed me. So maybe I am not askign my question correctly. – dillci Nov 07 '14 at 09:00