tags:

views:

14

answers:

2

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?

A: 

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.

Darin Dimitrov
A: 

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.

Developer Art
That is true. I just jumped into this app with really no mvc experience. There is an OnModelUpdated call that is the culprit. the data from form is properly going to the view model.Thanks.
Qudoos