There is one hack that would let you have an onSessionEnd event.  Well,
there are really two, because you can always roll your own session
management and be in 100% control.  The other is a concept I once
implemented in something called "SessionMagic" -- which was a set of custom
tags that is probably still floating around on the Exchange.

The basic concept is to make references to your sessions in the application
scope.  That prevents ColdFusion from timing out your sessions, but still
allows you to use the session scope as is.  At a very basic level this is as
simple as:

application.sessions[session.sessionID] = session;

You then have to manually time out your sessions, so in practice you end up
storing the last hit date (and potentially other information, depending on
what you want to do).  Since you do the timeout manually, the code you use
to time them out can do whatever "onSessionEnd" event you want.

Since "session" itself copies by reference you aren't really using much
additional memory with this method.  Of course, it also isn't fool-proof in
that if your application scope times out or is cleared for some reason
(i.e.: cf restarts) you lose your sessions anyway, but it is a workable
solution, particularly now that session and application variables are safe
from locking issues.

I haven't tried using this method in CFMX, but there's not theoretical
reason I know of it wouldn't still work.




> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Behalf Of Gary Menzel
> Sent: Thursday, December 11, 2003 2:14 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [CFCDev] session end event
>
>
> > In Asp, you can retrive the end session variable by using Session_OnEnd
> event
>
> <snip>
>
> > Do we have somethings like these in Coldfusion MX?
> > or how do you doit?
>
> I can't remember if I saw a reply to this.
>
> The short answer is "No".  But there are things you can do to slightly
> "fudge" it.
>
> Firstly, there is your Application.cfm - but of course, this is
> called for
> every page.  So what you do is create a flag of some type in your
> Application space that tells you all the global initialisation is done so
> you don't keep calling that code over and over.
>
> Secondly, there is an OnRequestEnd.cfm that is called for each
> page.  This
> doesn't really fit in either the Application or Session scopes but does
> give you a gauranteed file that will be called each time at the end of
> every page.
>
> There are no corresponding facilities for Session variables.
>
> All you can really do here is rely on the browser disconnecting or the
> Session timing out by itself (you can set this timeout in your
> <CFAPPLICATION> tag).
>
> One thing to be very careful of though is that Cold Fusion (by default)
> uses persistent Session cookies.  By this I mean that the CFID
> and CFTOKEN
> (which identify a Session) are stored as persistent cookies on
> the persons
> computer.  If they shut their browser down and re-open it again
> before the
> Session times out, the Session will still be active.
>
> To avoid this (which I suggest is actually what most people would want to
> do) you can do either or both of the following:
>
> Set the value of the SETCLIENTCOOKIES attribute on the <CFAPPLICATON> tag
> to be NO (the default is YES) and then initialise the CFID and CFTOKEN
> cookies yourself manually (the default in <CFCOOKIE> is to expire at the
> end of the Session):
>
> OR
>
> Stil set the value of SETCLIENTCOOKIES as above and pass the CFID/CFTOKEN
> on all URL parameters.
>
>
> Hope this helps.
>
>
> Gary Menzel
> Web Development Manager
> IT Operations Brisbane -+- ABN AMRO Morgans Limited
> Level 29, 123 Eagle Street BRISBANE QLD 4000
> PH: 07 333 44 828  FX:  07 3834 0828
>
> [EMAIL PROTECTED] wrote on 2003-12-11 06:54:15:
>
> > In Asp, you can retrive the end session variable by using Session_OnEnd
> event
> >
> > Here is a link with some good explanations:
> > http://docs.sun.com/source/817-2514-10/Ch8_BuildApp14.html
> > Application_OnStart event
> > Application_OnEnd event
> > Session_OnStart event
> > Session_OnEnd event
> >
> > Do we have somethings like these in Coldfusion MX?
> > or how do you doit?
> >
> > thanks
> > seng
> > ----------------------------------------------------------
> > You are subscribed to cfcdev. To unsubscribe, send an email
> > to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
> > in the message of the email.
> >
> > CFCDev is run by CFCZone (www.cfczone.org) and supported
> > by Mindtool, Corporation (www.mindtool.com).
> >
> > An archive of the CFCDev list is available at
> www.mail-archive.com/[EMAIL PROTECTED]
>
>
>
> If this communication is not intended for you and you are not an
> authorised recipient of this email you are prohibited by law from
> dealing with or relying on the email or any file attachments.
> This prohibition includes reading, printing, copying,
> re-transmitting, disseminating, storing or in any other way
> dealing or acting in reliance on the information.  If you have
> received this email in error, we request you contact ABN AMRO
> Morgans Limited immediately by returning the email to
> [EMAIL PROTECTED] and destroy the original. We will
> refund any reasonable costs associated with notifying ABN AMRO
> Morgans. This email is confidential and may contain privileged
> client information. ABN AMRO Morgans has taken reasonable steps
> to ensure the accuracy and integrity of all its communications,
> including electronic communications, but accepts no liability for
> materials transmitted. Materials may also be transmitted without
> the knowledge of ABN AMRO Morgans.  ABN AMRO Morgans Limited its
> directors and employees do not accept liability for the results
> of any actions taken or not on the basis of the information in
> this report. ABN AMRO Morgans Limited and its associates hold or
> may hold securities in the companies/trusts mentioned herein.
> Any recommendation is made on the basis of our research of the
> investment and may not suit the specific requirements of clients.
>  Assessments of suitability to an individual?s portfolio can only
> be made after an examination of the particular client?s
> investments, financial circumstances and requirements.
>
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email
> to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
> in the message of the email.
>
> CFCDev is run by CFCZone (www.cfczone.org) and supported
> by Mindtool, Corporation (www.mindtool.com).
>
> An archive of the CFCDev list is available at
> www.mail-archive.com/[EMAIL PROTECTED]
>

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to