setting timeout for session

S

Scott Walters

Hi,

I have an asp.net webapp that uses some javascript in a hidden frame on
the browser to poll the server every 30 seconds, using an http post.

I also want my sessions to timeout in the normal fashion. The way I'm
trying to get around this is by manually setting the timeout property
for the session.

I cache the starting session timeout value and inspect each url I get.
When I get the polling url, I take 30 seconds off the timeout value and
call set_timeout with the new, reduced value. Every time I get a url
different from the polling url, I call set_timeout with the original,
cached value.

Everything seems to be working right in the code, but for some reason
the sessions always end very shortly after the first poll, even if I
continually post with the non-polling url and set the session timeout
value very high in the web.config file.

Can anyone tell me what's going on here?

Thanks,
Scott Walters
 
S

Scott M.

Instead of continuously reducing the session.timeout property, how about
doing almost the same as you are doing now, but instead of setting the
timeout to a lower and lower value, just keep track of that value in a
variable. When the variable reaches zero, redirect the user to an .aspx page
that contains: Session.Abandon() and displays something like "Your session
has ended.".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top