Solved

ASP Session.Abandon and Session_OnEnd

Posted on 2002-07-26
6
772 Views
Last Modified: 2007-12-19
Folks,

I have added Session.Abandon to force Session_OnEnd to fire in global.asa, but this is not working.  I have tested the code in IIS4 (NT) and IIS5 (win2k) but all the same.

Can you help please.

Richard.Koudry@bt.com
0
Comment
Question by:koudry
6 Comments
 
LVL 22

Expert Comment

by:CJ_S
ID: 7179764
Session.Abandon will wpork the NEXT page.

So if you use:
Session.Abandon
response.write session("MYITEM")

The value will still be written. When you do the response.write the next page then it won't be there since the session object is totally empty.

next thing is that the Session.Abandon only takes care of the session variables inside and not of the true session the user is in.

CJ
0
 

Expert Comment

by:Pirado
ID: 7180313
verify the event erros.
0
 

Expert Comment

by:Pirado
ID: 7180316
add a single code to test...
something do not run into global.asa
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 7180335
One other issue: don't rely on the Session_OnEnd to work correctly. It is really a hit and miss proposition. If you need certain things to happen, do so through events on your page rather than relying on the global.asa.

Fritz the Blank
0
 
LVL 2

Expert Comment

by:chops123
ID: 7180861
There is a reported Microsoft bug on the Session_OnEnd Event in IIS 4.Im not sure if this has been fixed in IIS 5.

But its better not to script in this event.

Session handling has been a bit of an issue for many people.A session usually expires after 20 min by default.Of course you can always override the session timeout value in your pages or by specifying the session expiry time setting in the IIS.

For example you can store a session variable like session("myTime") = now() and then check something like this to expire after 1 min

If  DateAdd("s", -60, now()) > session("mytime") Then
    session.abandon
    Response.write "<B>session expired</b>"
Else
    Response.write "session exists"
End if

However the drawback to this is that this needs to be checked on each of the pages wherever your session needs to be expired.

Rgds
KC
0
 

Accepted Solution

by:
ComTech earned 0 total points
ID: 7183835
This question will be placed in PAQ, and points refunded.

Regards,

ComTech
Community Support Administrator  
Experts-Exchange  


But will be in PAQ where is can still be reached, should a working souluton is found, so at the request of the User this will placed in PAQ.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now