Reputation: 626
I have an asp.net mvc register view. This is the first page. If someone sits on it long enough for the session to expire, then start entering data and submit the form, it is automatically going into my HttpGet Action Result for register.
Is this default behavior? Can it be changed so the user does not get a session timeout on the first page of the website?
Upvotes: 0
Views: 641
Reputation:
If someone sits on it long enough for the session to expire, then start entering data and submit the form, it is automatically going into my HttpGet Action Result for register.
HTTP POST does not have anything to do with sessions (which are technology-stack specific). A form can be submitted in 5 minutes or in 5 years it's the same.
Upvotes: 0
Reputation: 1039110
I think you are confusing the notions of session, authentication, and binding values to action parameters. In your case I suppose you are talking about authentication. A non authenticated user cannot access actions and/or controllers decorated with the [Authorize]
attribute. If you are using FormsAuthentication the validity of the authentication cookie is defined in web.config:
<authentication mode="Forms">
<forms loginUrl="/login"
protection="All"
slidingExpiration="false"
timeout="30" />
</authentication>
You could adjust this timeout. If you want to increase the session timeout take a look at the sessionState
tag in web.config.
Upvotes: 1