ASP Session Timeout Question

Status
Not open for further replies.

JHS

Ars Tribunus Militum
2,742
Subscriptor++
I'm trying to figure out what user actions will prevent their ASP Session from timing out. Microsoft describes it as follows:
A session automatically ends if a user has not requested or refreshed a page in an application for a specified period of time.

Most other sources say the same thing. Does the user's request have to be to an ASP page within the application to prevent the timeout? Or will any request (static page) to the web server keep the session alive?

-john
 

kleel

Ars Scholae Palatinae
1,022
AFAIK you can disable the ASP Session timeout in an ASP page by
code:<HR>
Code:
 Session.Timeout=0

Correct me if I'm wrong but I also think that IIS only has the notion of a session when dealing with ASP files.

I suppose a session's timeout value starts to decrease from whatever it set to until it expires (or == to 0).

so, if you click on a ASP page the timeout value is reset to what ever the default is and then it starts counting down.

Kleel
 

temp

Seniorius Lurkius
44
Most other sources say the same thing. Does the user's request have to be to an ASP page within the application to prevent the timeout? Or will any request (static page) to the web server keep the session alive?

The user has to request ASP pages to keep the session alive. .htm or .gif files won't make any difference. The session can also be lost if the user closes his or her browser, or deletes temporary cookies in some other way.

Allowing an infinite timeout as suggested above is probably a bad idea, since the sessions will gradually clog up the server. But if your server isn't too heavily loaded you can set the session timeout to 24 hours.
 

JHS

Ars Tribunus Militum
2,742
Subscriptor++
Originally posted by cplayer:
Do not use session to track anything you care about keeping. It is crap. Instead, when the user logs in create an entry for them in a db and give them a GUID that you pass along with the url or in submitted form data.

Yeah, we keep all the pertinent session information in a db table. The ASP session simply holds an id from the table. With the ASP session, we can use Session_OnEnd to close the users session in the database in case they don't explicitly hit our logout script.

Thanks for your feedback temp, that answered my question.

-john
 
Status
Not open for further replies.