Solved

ASP Session.Abandon and Session_OnEnd

Posted on 2002-07-26
6
780 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…

830 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