Richard,

While I am not 100% sure of this, I believe that OnSessionEnd doesn't
have access to the Application scope direction (or the session scope). I
think both scopes are passed in AS arguments to the method and can only
be accessed in that fashion:


<cffunction name="OnSessionEnd" access="public" returntype="void"
output="true" 
        hint="Fires when the session is terminated.">
        
        <!--- Define arguments. --->
        <cfargument name="SessionScope" type="struct" required="true" />
        <cfargument name="ApplicationScope" type="struct"
required="false" default="#StructNew()#" />
        
        <cffile
                action="APPEND"
                file="#ExpandPath( './trace.txt' )#"
                output="OnSessionEnd : [ID -
#ARGUMENTS.SessionScope.CFID#] [TOKEN -
#ARGUMENTS.SessionScope.CFTOKEN#]"
                addnewline="true"
                />
                
        <!--- Return out. --->
        <cfreturn />
</cffunction> 

Hope that helps.


......................
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 6:23 AM
To: CF-Talk
Subject: onSessionEnd function not getting called

Hi,

I'm having problems trying to get the onSessionEnd function to work in
the Application.cfc file.

I can confirm that the sessions are being created and that they are also
dropping after the specified time. However, no further action is taken
when the session is ended. I've tested the code within the onsessionend
function and that seems to work, it just doens't appear to be called?

Here's the code:

[code]


<cfcomponent output="false">

<!--- Global Application Settings --->
<cfset setEncoding("url","utf-8")>
<cfset setEncoding("form","utf-8")>
<cfcontent type="text/html; charset=utf-8">

<cfset THIS.name = "PomAdminzone">
<cfset THIS.sessionManagement = true>
<cfset THIS.sessiontimeout = createtimespan(0,0,0,20)> <cfset
This.applicationtimeout= createtimespan(5,0,0,0)>


<cffunction name="onRequestStart" output="true">
        <!--- Global Site Settings --->
        <cfset THIS.scriptProtect = "all">
        <cfinclude template="../_company-info.cfm">
        <cfinclude template="_login-check.cfm">
        <cfset REQUEST.theDirection = 'ltr'>
        <cfset REQUEST.theLingo = 'en'>
        <cfset REQUEST.theLayout = 'layout-admin2.cfm'>
        <cfset REQUEST.theStyle = 'layout-admin2.css'>  
        <cfset REQUEST.useContent = 'yes'>      
</cffunction>

<cffunction name="onSessionStart">
        <cfinclude template="../_company-info.cfm">
        <cfset SESSION.created = now()>
        <cfquery name="changeStatus" datasource="#REQUEST.theDatabase#">
        UPDATE  companyDetails
        SET             status = 'ONLINE'
        WHERE   companyID = <cfqueryparam value="#REQUEST.companyID#"
cfsqltype="cf_sql_integer" />
        </cfquery>

</cffunction>


<cffunction name="onSessionEnd">
<cfinclude template="../../../customtags/getSessionList.cfm">
<cfif StructIsEmpty(getSessionList(application.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>


</cfcomponent>


[/code]

Any ideas how to resolve this?




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:262861
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to