In the ApplicationTemplates in Application.CFC does Client Cookies have to be turned on for ColdBox

In the ApplicationTemplates in Application.CFC

this.setClientCookies = “yes”

Does ColdBox need client cookies? or can this be turned off?

I assume that it can be turned off with no issues…

ColdBox is not reliant on client variables. The only real requirements are application and session scope.

Okay… I am having an issue…

I created a new application with the Advanced Template

I set 3 session variables for testting sessions.

In Main.cfc -

In the onSessionStart

session.atest = true;

In the onRequestStart

session.btest = true; // Not sure what good this does since it gets reset on each new request.

In the General.cfc

In the Event Index

session.ctest = true;

I created a new event called HOME in home I simple dump the session scope.

In the Application.cfc

I hit the site and then I go to the even t General/Home (not index.) I see the session.btest
I go to the event General.Index I see both session.btest and session.ctest

I close the browser and reopen the browser and I go straight to http://localhost/testingColdBox/index.cfm/General/home

session - struct
btest true
cbstorage
session - struct [empty]

cfid 18000
cftoken 83457644
ctest true
sessionid 3ABD13E89203DC7B1E3EC32C5BD526EB_18000_83457644
urltoken CFID=18000&CFTOKEN=83457644

The btest and ctest are both found in session.

  1. Shouldn’t ctest be GONE?
  2. Can you set session vars in onSessionStart?

If you are going to be doing anything with session, especially within ColdBox itself I would be more inclined to look at the events onSessionStart or the interceptor equivalent.

And then use the sessionStorage plugin.

In your example, you are probably running into a scenario where, the application is being run before you are setting the variable, and then later you are getting it because it is being set after ColdBox has been run.

Without knowing exactly where you are placing these variables inside these application events, then it is hard to give you a straight answer. But I am guessing that you are setting the variable in the scope after ColdBox is calling its event handling.

But I still would be more worried about using the ColdBox events for the equivalent application events, or the same in the interceptor as doing anything that you require to be setup for use within ColdBox.

I found the issue.

Feeling stupid… LOL We only had to add this to the application.cfc

you should also have a coldbox hook in there as well.