|
Prev: CFLOOP Problem
Next: ColdFusion 8 - Serving XML
From: pflynn02 on 23 Apr 2008 00:21 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!
From: GArlington on 23 Apr 2008 05:16 On Apr 23, 5:21 am, "pflynn02" <webforumsu...(a)macromedia.com> wrote: > 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! Session scope are independent of your application scope, if you maintain session over two applications, then yes. Just try to set session var in one app and check it when you switch to another app, if you have a problem explain what you have done and what is the problem...
From: Ian Skinner on 23 Apr 2008 09:15 pflynn02 wrote: > 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 Application.cfc A template can declare <cfapplicaiton ...> more then one time. So you can do something like this in a specific template to combine the two application scopes. <cfapplication name="App1"...> <cfset variables.localVariable1 = application.applicationOneVar> .... <cfapplication name="App2"...> <cfset variables.localVariable2 = application.applicationTwoVar> <cfif variables.localVariable1 = variables.localVariable2> <!--- Do stuff with the comparison ---> </cfif>
From: pflynn02 on 23 Apr 2008 16:07 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...
From: BKBK on 24 Apr 2008 00:08
[i]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? [/i] 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. |