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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use Session.Abandon? 1

Status
Not open for further replies.

greathope123

Programmer
Nov 1, 2011
84
GB
Hi,

Can you tell me why this not works:
<%
Session("abc")="abc"
response.write "Session(""abc"") = " & Session("abc") & "<br>"
Session.Abandon
response.write "After Session.Abandon, Session(""abc"") = " & Session("abc") & "<br>"
%>
The output is:
Session("abc") = abc
After Session.Abandon, Session("abc") = abc
 
The session variables are not destroyed until the script has completed and exited.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Session("abc") looks like a function: when we call the function, the function gets the session value and returns it? No??
 
Abandon() is an 'empty' method, it takes no parameters and does not return a value. It's only purpose is to tell the server to destroy the current session as soon as the script ends rather than waiting for the session to timeout. Useful for making sure that a logout occurs when the user closes their browser instead of it staying active for 20mins.



Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
I think you can buffer the output. So, the server will hold back on dishing anything out until it has run the entire script. I think that will allow you to pull of your script.

<%response.Buffer=true%> needs to go at the beging of your page.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top