I'm trying somthing similar and for some reason the method is not triggered
if the onSessionEnd is called automatically when the sessuin has time out.
If I call it manually is fine.
this is the code:
<cffunction name="onSessionEnd" output="false">
<cfargument name = "sessionScope" required="true" />
<cfargument name = "applicationScope" required="true" />
<cfset var sessionLength = timeFormat (now () - sessionScope.started,
"H:mm:ss")>
<cflock name="AppLock" timeout="5" type="Exclusive">
<cfset arguments.applicationScope.sessions =
arguments.applicationScope.sessions - 1>
</cflock>
<cflog file="#this.name#" type="Information"
text="Session #arguments.sessionScope.sessionid# ended. Length:
#sessionLength# Active sessions: #arguments.applicationScope.sessions#">
<cflock scope="session" timeout="10" Type="Exclusive">
<cfscript>
if (isDefined ("arguments.sessionScope.userID") and
arguments.sessionScope.userID gt 0)
{
arguments.applicationScope.userDAO.setLogStatus (
arguments.sessionScope.userID, 0);
}
</cfscript>
</cflock>
<cfset this.sessiontimeout = 0>
</cffunction>
When a user logs in, a flag in the databse is set so the user cannot log
second time on a different computer unless he/she manually logged out or the
sesssion times out. Unfortunately, it doesn't work when the session times
out and users are stuck.
No error is generated and I can't see anything wrong
Thanks
Victor
On 12/5/06, Raymond Camden <[EMAIL PROTECTED]> wrote:
>
> Ditto what Ben said. 9 times out of 10 the issue is an error in the
> method. You may also try using onError and see if it fires off.
>
> p.s. Add some var scoping to your query name. Or just remove the name.
>
> Also - you are including a template that has getSessionList? Did I see
> that right? You can't cfinclude a UDF inside a method.
>
> On 12/5/06, Ben Nadel <[EMAIL PROTECTED]> wrote:
> > You query might be breaking? Try removing the query and just write
> > something to a file, something really simple like "SESSION ENDED". That
> > way at least you will know that the session ended and was not erroring
> > out.
> >
> >
> > ......................
> > Ben Nadel
> > Certified Advanced ColdFusion MX7 Developer
> > www.bennadel.com
> >
> > Need ColdFusion Help?
> > www.bennadel.com/ask-ben/
> >
> > -----Original Message-----
> > From: Richard Cooper [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, December 05, 2006 9:41 AM
> > To: CF-Talk
> > Subject: Re: onSessionEnd function not getting called
> >
> > Still not working :(
> >
> > I've tried including the new code such that the onsession end now looks
> > like:
> >
> > <cffunction name="OnSessionEnd" access="public" returntype="void"
> > output="true" hint="Fires when the session is terminated.">
> > <cfargument name="SessionScope" type="struct" required="true" />
> > <cfargument name="ApplicationScope" type="struct"
> > required="false" /> <cfinclude
> > template="../../../customtags/getSessionList.cfm">
> > <cfif
> > StructIsEmpty(getSessionList(Arguments.ApplicationScope.applicationname)
> > )>
> > <cfquery name="changeStatus" datasource="#REQUEST.theDatabase#">
> > UPDATE companyDetails
> > SET status = 'INTERMITTANT'
> > WHERE companyID = <cfqueryparam value="#REQUEST.companyID#"
> > cfsqltype="cf_sql_integer" />
> > </cfquery>
> >
> > </cfif>
> >
> > </cffunction>
> >
> > I didn't change any other code within the file. I had a look at the
> > adobe docs for this and it used AppScope which I also tried but still no
> > joy.
> >
> > Do I need to make amendments elsewhere in the doc to get this to work?
> >
> >
> >
> >
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:262946
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4