ASP Session.Abandon and Session_OnEnd

Posted on 2002-07-26
Last Modified: 2007-12-19

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.
Question by:koudry
LVL 22

Expert Comment

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

So if you use:
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.


Expert Comment

ID: 7180313
verify the event erros.

Expert Comment

ID: 7180316
add a single code to test...
something do not run into global.asa
Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

LVL 46

Expert Comment

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

Expert Comment

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
    Response.write "<B>session expired</b>"
    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.


Accepted Solution

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


Community Support Administrator  

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.


Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Jquery GMAP3 Hierarchy 1 28
Getting selected value of a dropdown with jquery 7 38
Javascript Form Change 5 23
If condition on Html with Asp 11 17
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…

777 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