If only that were true!
You need to be very careful. Say you have a session variable
session("username")="greg". If the users walks away from the machine and
comes back 20+ minutes later and causes a postback on your page a new
session will start.
When you go to access your session("username") variable that you thought was
populated you'll get an exception because it will be now equal to nothing!
This scenario has caused me many many headaches. ;(
You can/should always check your session variables for nothing before using
them. Same will Cache items, cause those can be purged at any point in time.
PS: If anybody has ever figured at a full proof way of displaying a session
expired page while using forms authentication, I would love to hear it!
Greg
"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:18**********************************@microsof t.com...
Hi just started using session variables, no expert but this is what I have
seen so far. Session variables exist from when the web application is started until it
is ended. It is started when the browser of the user opens the start page and ends
when the user no longer has any page open from the application. Session
variables are visible to all pages of the application when invoked. --
Paul G
Software engineer.
"Timothy V" wrote:
Hi,
I was wondering how long the created session variables last for?
To be more clear, when are they destroyed? Do I have to set the
variables to null in Session_End()? Is the Session_End() method invoked when the
browser is closed?
I'm just not sure how it works.
Thanks in advance,
Tim.