1

I am having a very strange issue, no matter what I do I could not stop the page from timing out. Here is the scenario We have a couple of pages with lots of data, the client selects some check boxes, select values from various drop downs etc. Some times the clients spend more than 30 minutes selecting/setting values. When they click on Submit the page timeouts and takes them to login page. When you login back in all the set values would be gone. Very frustrating. One would think selecting drop downs, entering data into text boxes etc. would be considered doing some activity on the page that should keep the session alive. But it doesn't seem to be the case. I have tried increasing the timeout value with out success.

Here is the code from web.config

    <authentication mode="Forms">
        <forms loginUrl="~/public/Login.aspx" slidingExpiration="true" timeout="200" protection="All" name="SampleApp"/>
    </authentication>
    <sessionState mode="InProc" cookieless="false" timeout="200"/>
    <httpRuntime maxRequestLength="204800" executionTimeout="3600" />

We also have machinekey tag setup with encryption keys.

Appreciate any help. Thanks in advance.

5
  • do you have a distributed server ? Commented Jan 21, 2016 at 0:28
  • If there's ever a chance that a user could lose 30 minutes worth of work, perhaps you should be constantly saving in the background. Either to the server via AJAX or perhaps just using HTML5 localStorage. Commented Jan 21, 2016 at 1:02
  • Have you tried to extend timeout via IIS? See there: forums.asp.net/t/… Commented Jan 21, 2016 at 1:21
  • What happens if users submit the page within 5 minutes of logging in? Do they still get re-directed to login page? If your answer is yes then you have some other issues in your app and it's not the timeout value that you have specified. In that case, one possibility is that you are not setting the forms authentication ticket correctly in your code. Commented Jan 21, 2016 at 5:08
  • Thank you Sunil, the cookie timeout is set to 20 minutes in the code. I increased it to an hour and no timeouts so far :) Commented Jan 21, 2016 at 19:05

2 Answers 2

2

In ASP.Net, any client-side activity that does not involve posting/sending data to web server has no effect on forms authentication sliding expiration time out. So if your users are simply selecting values in drop down without posting back and scrolling through the big page, it will not extend the timeout period.

However, if this is a problem then you can write an empty asmx web service method that does nothing and returns void. You would then call this from your page's JavaScript code every 5 minutes using a JavaScript interval timer i.e. setInterval. This call will send a request to web server and your users will not time out as is happening now. Also, this call will be so light and quick that your users will never know it's happening.

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

Comments

1

Increased the cookie timeout period in FormsAuthenticationTicket class and the problem is gone. Thank you all

Comments

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.