1
votes

This is embarrassing. I've been a ColdFusion developer for 13 years and I've never had a reason to use client management over session management. Anyway, I've set up a database and datasource in CFAdmin, then selected that datasource as the default storage mechanism for client sessions.

Then I went through all my code and global-replaced all my session scopes with clients scope.

Top of my application.cfm looks like:

<CFAPPLICATION 
    NAME="blah"
    SESSIONMANAGEMENT="No"
    SESSIONTIMEOUT=#CreateTimeSpan(0,2,0,0)#
    CLIENTMANAGEMENT="Yes"
    CLIENTSTORAGE="sys_blah"
>

In my application.cfm, I had previously set a few variables globally related to session authentication, i.e.

<cfparam name="session.user.authenticated" default="0">
<cfparam name="session.user.id" default="">

However, now that these are written as

<cfparam name="client.user.authenticated" default="0">
<cfparam name="client.user.id" default="">

I get an error:

Element USER is undefined in CLIENT.

What might I be doing wrong?

I can see the client vars going into the newly-created database. I'm on CF12

1
<cfdump var="#client#'> gets you started. Your embarrassment is justified for not knowing this after 13 years. - Dan Bracuk
Respectfully, I disagree. They did not say they do not know how to use cfdump or that they had not tried it ;-) We all get tripped up by small stuff on occasion, despite years of experience. Sometimes you just need a little jolt or second set of eyes to nudge you back on track. Especially for those that work solo. The problem may be that CF is treating the key name as user.id, rather than a structure named user, with a key named id. Of course, that brings us back around to Dan's first point, which I do agree with :) You should use cfdump to confirm or disprove that theory. - Leigh

1 Answers

3
votes

Client variables must be simple data types: strings, numbers, lists, Booleans, or date and time values. They cannot be arrays, recordsets, XML objects, query objects, or other objects. If you must store a complex data type as a client variable, you can use the cfwddx tag to convert the data to WDDX format (which is represented as a string), store the WDDX data, and use the cfwddx tag to convert the data back when you read it. For more information on using WDDX, see Using WDDX.

http://help.adobe.com/en_US/ColdFusion/10.0/Developing/WSc3ff6d0ea77859461172e0811cbec0c35c-7fd5.html

So... WDDX or JSON would work.