views:

30

answers:

2

i have a form where user enter some information. The problem is when they submit the form, due to session timeout, the page redirected to login page. After login they return to the same page but the form is empty and all information is lost which is very annoying for the user.

What is the best solution? I don't want to refresh the page. Should I send ajax request after every 5 minutes.

NOTE: The current Session Timeout is 40 minutes and it is stored in database.

A: 

If sliding expiration is enabled you could indeed poll the server at regular intervals to ensure that the session doesn't expire.

Darin Dimitrov
@Darin Dimitrov i am not using forms authentication.
A: 

Pass the formcollection to the logon page to pass back to the form after redirecting.

EDIT: You can modify the action that the form posts to so that instead of sending unauthorized users to the logon action strait away you can have it first check if the user is authenticated then if not save the data somewhere (sql table or a cookie should be fine) and send the user to the logon action or continue to handle the data as normal. Have a parameter passed to the form action that indicates if and where to retrieve the saved data.

James Santiago
@James Santiago, How can I pass as I am redirecting (GET Request), while the formcollection is in POST Request.