• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 840
  • Last Modified:

ASP Session.Abandon and Session_OnEnd

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
koudry
Asked:
koudry
1 Solution
 
CJ_SCommented:
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
 
PiradoCommented:
verify the event erros.
0
 
PiradoCommented:
add a single code to test...
something do not run into global.asa
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

 
fritz_the_blankCommented:
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
 
chops123Commented:
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
 
ComTechCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now