What is the minimum necessary code to keep a session alive in classic ASP?
I have a classic ASP site that I would like the sessions to stay alive a开发者_运维知识库s 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?
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.
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.
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("."); -->
精彩评论