Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Are session variables available in Session_OnEnd?

Status
Not open for further replies.

BigM

Programmer
Aug 30, 2000
39
GB
Hi,

A quick question....are session variables still available in Session_OnEnd or are they destroyed before this sub is called?

Thanks
 
Session variables are available until the script that terminated the session finishes executing. Example:

Code:
...
session("name") = "John"

session.abandon

response.write session(&quot;name&quot;) & &quot;<BR>&quot;

response.write &quot;page finished<BR>&quot;
...

Given the function in global.asa:

Code:
sub session_onEnd()
       response.Write(&quot;name = &quot; & Session(&quot;Name&quot;) & &quot;<BR>&quot;)
       response.Write(&quot;Session terminated<BR>&quot;)
end sub

will generate

Code:
John
page finished
name = John
session terminated


But after the page has finished the session variables will be unavailable.

Session_OnEnd is fired just before the session ends so the above will hold.

(of course this will fail if the session times out because the response.writes are not possible in that case)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top