I have a page that uses Session variables when generating the SQL
statements used to submit and retrieve data from a database. However,
because I don't know how long the user will be on the page, setting
the Session.Timeout property doesn't help me avoid errors (I can
obviously set the value to a very high value, but that still doesn't
completely solve the problem). Is there any way for me to avoid the
Session timing out? Thanks.
Instead of setting the session timeout to long values, maybe you can
prevent the session from timing out, by using regular postbacks.
A session timeout of an hour means that the session variables stay
around for an hour after the user has closed his browser.
You could use a regular (once every 10 minutes is enough, as long as it is
within the regular session timeout) AJAX callback that does nothing special
except (by it's callback) refresh the session. You will need to enable
session-state for this callback however.
The user should not notice this and the session is kept open as long as
that user keeps the page open. And the session is ended reasonably
soon after he has closed his browser.
Hans Kesting