User Guide
onSessionEnd 959
onSessionEnd
Description
Runs when a session ends.
Syntax
<cffunction name="onSessionEnd" returnType="void">
<cfargument name="SessionScope" required=True/>
<cfargument name="ApplicationScope" required=False/>
...
</cffunction>
See also
onSessionStart
, Method summary, “Managing sessions in Application.cfc” in ColdFusion MX
Developer’s Guide
Parameters
ColdFusion MX passes the following parameters to the method:
Returns
This method does not return a value; do not use the cfreturn tag.
Usage
Use this method for any clean-up activities when the session ends. A session ends when the
session is inactive for the session time-out period or, if using J2EE sessions, the user closes the
browser. You can, for example, save session-related data, such as shopping cart contents or
whether the user has not completed an order, in a database, or do any other required processing
based on the user’s status. You might also want to log the end of the session, or other session
related information, to a file for diagnostic use.
If you call this method explicitly, ColdFusion does not end the session; it does execute the method
code, but does not lock the Session.
You cannot use this method to display data on a user page, because it is not associated with a
request.
You can access shared scope variables as follows:
• You must use the SessionScope parameter to access the Session scope. You cannot reference
the Session scope directly; for example, use Arguments.SessionScope.myVariable, not
Session.myVariable.
Parameter Description
SessionScope The Session scope
ApplicationScope The Application scope;