This is the process i use to keep a session-less site? Does anyone have any better suggestions?
var memberObj = {
MemberID = request.MemberStruct.userData.MemberID,
SessionKey = request.MemberStruct.userData.SessionKey,
};
cfcookie(
name = “cookiename”,
expires = 30,
value = “#encrypt(serializeJSON(memberObj,true),application.key,”cfmx_compat”,”hex”)#”,
httpOnly = true,
preserveCase = true,
secure = true
);
When I was in this situation (where we weren’t able to use sessions) we used client variables instead. They can be stored in different ways, including cookies, but it looks like it would be a simpler solution to the one you are proposing.
The drawback is that you can’t use complex objects with client variables, so you would have to change your approach a bit from the one you give in the example above.
You can find more information on client variables here: https://helpx.adobe.com/coldfusion/developing-applications/developing-cfml-applications/using-persistent-data-and-locking/configuring-and-using-client-variables.html
You must be logged in to post a comment.