November 17, 2017
What is the best way create a session-less site?
Comments
(1)
November 17, 2017
What is the best way create a session-less site?
Newbie 1 posts
Followers: 0 people
(1)

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
);

 

 

1 Comment
2018-02-15 12:10:15
2018-02-15 12:10:15

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

Like
Add Comment