This content has been marked as final. Show 3 replies
> I have an Application.cfm in the root of my site called App1. I have a
> directory in this site called Signup with an Application.cfm named App2, I
> would like App2 to check my Session.LoggedIn variable of the App1 application.
> Is this possible to do? If so how, i have been racking my brain on this for a
> few days. Thanks in advance!
A template has access to the application scope defined by the name given
in the <cfapplication name="..."> tag or the this.name of a an
A template can declare <cfapplicaiton ...> more then one time. So you
can do something like this in a specific template to combine the two
<cfset variables.localVariable1 = application.applicationOneVar>
<cfset variables.localVariable2 = application.applicationTwoVar>
<cfif variables.localVariable1 = variables.localVariable2>
<!--- Do stuff with the comparison --->
Here is exactly what im trying to do, im not sure I understand your example...
App1 has a variable called : SESSION.MYACCOUNT
App2 needs to see if that SESSION.MYACCOUNT variable IsDefined BUT
when I tried to check it, it is looking in the App2 sessions not App1, how do I look in App1 for the SESSION.MYACCOUNT? Thanks...
App2 needs to see if that SESSION.MYACCOUNT variable IsDefined BUT when I tried to check it, it is looking in the App2 sessions not App1, how do I look in App1 for the SESSION.MYACCOUNT?
You can't. Sessions are privately owned by applications. App2 cannot read App1's session variables.
The following strategy will work. Assume the location of App1's Application.cfc file is wwwroot/app1/. Then add the 'extends' attribute to App2's Application.cfc file, as follows
<cfcomponent extends="app1.Application" ... etc>
App2 can now have access to App1's session variables. However, this is not a sweet structure, as it defeats the purpose of separate applications.