This content has been marked as final. Show 5 replies
> Hi guys
> I'm using session vars to maintain whether or not a user is logged in on our
> site. The only problem is is that the session vars seem to be lost after I call
> a CFC that then does a CFHTTP post.
> Does anyone know how I maintain the session vars?
> All the best
Why do you say they are lost? Are you sure you did not just misplace them?
In other words nothing about CFC's or CFHTTP would intrinsically destroy
session variables in memory. But they could easily not have access to
the scope as you desire if you do not understand how templates and cfml
code are associated with a given session scope when it is running in memory.
Thanks for the reply.
Thank you for clarifying that the session vars are not 'lost'. I was hoping that would be the case.
Please could you expand on how I would regain access to them through the correct scope.
Many thanks in advance.
My method is to not use session variables inside cfc's. Anything the functions need are passed as arguments.
> Please could you expand on how I would regain access to them through the
> correct scope.
Posting the relevant bits of your code and telling us exactly what's going
on, and how you've tried to troubleshoot it would be a good start.
Does anyone know how I maintain the session vars?
Yes. Do the following:
1) Navigate to Server Settings => Memory Variables in the Coldfusion Administrator. Enable the use of application variables as well as session variables.
2) Your Application.cfc file should at least contain a setup like this
this.name = "yourAppName";
this.applicationTimeout = "#createTimeSpan(1,0,0,0)#";
this.sessionManagement = "yes";
this.sessionTimeout = "#createTimeSpan(0,0,20,0)#";