View Full Version : Quick question about session variables

08-26-2004, 11:00 PM
I have a session variable that I set on my login page (valid_login=true) then I check on load of all my other pages to see if valid_login is true, if it's true I contine to load page, other wise I send them to the login page.

I have noticed during testing and codeing if there is some time between activity (page changes what ever) on my test PC that it will send me back to the login page when I finaly get around to changing/refreshing the page (IE: bring up a page on test PC then go do some coding on work PC for 10-20 min or so then go back to test PC click on home button and it will send me to login page, and yes my home button normaly works just fine ;) ).
So I was wondering:

- Can/Do session variables time out?
- What the default is?
- Can you change the default & how?

To learn is a good thing and today I hope to learn something new!!

08-26-2004, 11:20 PM
When does a Session End?
A session ends if a user has not requested or refreshed a page in the application for a specified period. By default, this is 20 minutes.

If you want to set a timeout interval that is shorter or longer than the default, you can set the Timeout property.

The example below sets a timeout interval of 5 minutes:


To end a session immediately, you may use the Abandon method:


Compliments of W3Schools.com (http://www.w3schools.com/asp/asp_sessions.asp)

08-27-2004, 03:58 AM
Thanks Morgoth :thumbsup:

To learn is a good thing and today I have learned something new!!

08-27-2004, 05:35 AM
No problem man.
And W3Schools is a great source for ASP help, along with a few other languages.