Dump Out a User's ColdFusion Session

Posted 11/29/2016 1:54 PM by Corey Klass

Given a particular applicationName and JSessionID in ColdFusion, the following code will return a dump of the user's session.

<cfparam name="url.applicationName" default="" type="string" />
<cfparam name="url.jsessionID" default="" type="string" />

<cftry>
    <cfscript>
        sessionTracker = createObject("java", "coldfusion.runtime.SessionTracker");

        appSessions = sessionTracker.getSessionCollection(javaCast("string", url.applicationName));

        sessionID = url.applicationName & "_" & url.jsessionID & ".cfusion";
        targetSession = appSessions[sessionID];
    </cfscript>

    <cfdump var="#targetSession#" />

    <cfcatch type="any">
        <cfdump var="#cfcatch#" />
    </cfcatch>
</cftry>