Question

We are noticing a number of issues relating to our website for shopping cart data.

As the cart data is stored in the user's session, I'm wondering whether it's possible to open a specific session from a script and dump out the output if we have the session ID?

It would be useful to know so we can see what is specifically in a user's session that may be causing the issues to occur.

Was it helpful?

Solution

Yes you can:

<cfscript>
    app = 'YOUR_APPLICATION_NAME';
    sessiontracker = createObject("java","coldfusion.runtime.SessionTracker");
    sessionCollection = sessionTracker.getSessionCollection(app);

    structEach(sessionCollection, function(k,v){
        writeDump(sessionCollection[k]);
    });
</cfscript>

This script basically lists all the session objects for a given application on your server. You can change it to your needs to find out the relevant session based on the keys you put in your session.

thisSession = sessionCollection[k];
//loop through thisSession keys

I do not have a working CF box with me now to test this to perfection; but I believe you will be in the right direction.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top