I have this code in my Application.cfm that returns the number of sessions and 
the 
number of sessions with a user loggedIn. Unfortunately the sessions do not 
timeout 
and keep accumulating.

>From LiveDocs: "If you use J2EE session management, ColdFusion MX ends the 
>session and deletes all 
Session scope variables when the user closes the browser."
How do you do this?

Or maybe there is an error in my code?

=================

<cfapplication name="#prefix#_blog_#blogname#" 
clientManagement = "no" 
setClientCookies = "no" 
setDomainCookies = "no" 
loginStorage = "session" 
sessionManagement = "yes" 
sessionTimeout = #CreateTimeSpan(0,1,0,0)#
applicationTimeout = #CreateTimeSpan(1,0,0,0)#>

<cfscript>
function getSessions(appName) {
var tracker = createObject("java","coldfusion.runtime.SessionTracker");
return tracker.getSessionCollection(appName);
}
</cfscript> 
<cfset structDelete(session,"nSessions","TRUE")>
<cfset structDelete(session,"nLoggedIn","TRUE")>
<cfset session.nSessions = 0>
<cfset session.nLoggedIn = 0>
<cfset sessions = getSessions(application.applicationName)>
<cfset session.nSessions = structCount(sessions)>
<cfloop item="s" collection="#sessions#">
<cfif structKeyExists(sessions[s],"username")>
<cfset session.nLoggedIn = session.nLoggedIn + 1>
</cfif>
</cfloop>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7 
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs 
http: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:267827
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to