Steve Ed
Steve Ed

Reputation: 525

ASP.net Page session timeout not working

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.

Upvotes: 1

Views: 760

Answers (2)

Steve Ed
Steve Ed

Reputation: 525

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

Upvotes: 1

Sunil
Sunil

Reputation: 21406

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.

Upvotes: 2

Related Questions