Dump ALL sessions in coldfusion!

http://succor.co.uk/index.cfm/…

I found this very interesting blog from a cf-talk discussion, and found it was worth blogging.

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”> <html>

<head>

<title>session tracker</title>

</head>

<body>

<cfapplication name=“”>

<cfset request.overallTotal = 0 />

<cfloop collection=“#application#” item=“applicationName”>

<cfscript>

sessiontrackerObj= createObject(“java”,“coldfusion.runtime.SessionTracker”);

activesessions = sessiontrackerObj.getSessionCollection(‘#applicationName#’);

nosessions=ListLen(structkeyList(activeSessions));

</cfscript>

<cfif nosessions>

<cfoutput>

<h3>Total Sessions for #applicationName#: #nosessions#</h3>

</cfoutput>

<cfif structKeyExists(url,“showSessions”)><cfdump var=“#activesessions#”></cfif>

</cfif>

<cfset request.overallTotal = request.overallTotal + nosessions />

</cfloop>

<h3 style=“position:absolute; top:0; right:0; width:200px;”>OVERALL SESSIONS:

<cfoutput>#request.overallTotal#</cfoutput></h3>

</body>

</html>

Leave a comment