5

I have a classic ASP site that I would like the sessions to stay alive as long as the user has a page open. So I used some Javascript to periodically call a 'keepalive' ASP page to keep the session alive so the timeout is not reached.

What do I need to put in the ASP page code to make sure it renews the session timer? Can it be a blank page or do I need to hit the Session object?

3 Answers 3

6

From MSDN:

A session automatically ends if a user has not requested or refreshed a page in an application for a specified period of time.

Based on that description, I don't think it matters what's in your "keepalive" script, as long as the request is made.

1
  • 1
    All sessions will be killed when the Application Pool recycles, so check the settings in IIS as the defaults are set to recycle after a certain number of requests or a period of time. You can configure it to recycle at specific times of day (say during your quietest period) so that fewer users are affected. Sep 20, 2011 at 8:54
1

I use a small inline frame at the bottom of a page to do this in admin sessions where the user is editing conent. All that's in the frame page is a meta refresh that fires every 5 minutes to keep the session alive. Works great.

2
  • This solution didn't work in case user may close their browser Jun 22, 2018 at 10:15
  • That's how sessions work. They are meant to be temporary, and won't persist if the browser is not active. Jun 22, 2018 at 17:22
0

It has been my experience that as long as you perform some kind of server process periodically, the session doesn't end.

What I do is have a javascript function that is periodically run via a setInterval() function call in the onLoad process of the tag.

In that function I execute a server-side SQL query.

I place this inside the section with all of javascript and styleshooe loads:

Then I place the following lines right after my tag:

--> RSEnableRemoteScripting("."); -->

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.