views:

41

answers:

3

So I have a timer that makes an async post back every 15 minutes. I have the webconfig set up to timeout after 60 minutes. But will it still time out? From what I can tell it won't, is there a way to make it still time out?

+2  A: 

Forcing an asynchronous call will keep your asp.net session alive as long as the page with the timer is left open.

However, you need to think if this is what you want the desired behaviour to be. For example, if your user has had to login to their session do you want the session to stay alive, if for example, they have walked away from their computer for their lunch break?

You also don't need to set your web.config to 60 minutes. If using this technique every 15 minutes the standard 20 minutes timeout will be more than adequate.

An alternative solution would be to pop up a message to the user asking if they wish to stay logged in. If they respond yes, do the postback.

To get it to still timeout, stop the automatic postback after the 3rd go (15*3=45 + 20m standard = 65 minutes)

CResults
+1  A: 

If you have set the timeout value to a longer time it won't expire. If you still want to invalidate the session you can programatically call the Abandon() method (for example after the fourth postback call).

mamoo
A: 

Making an async postback will keep the session alive so I don't see it timing out at all. Instead of doing an async postback every 15 mins do it once in 55 mins where you show the user the count down informing them that their session is going to timeout. If they want to reset it then let them click on a button in that window and then you can do an async postback.

HTH

Raja