Can The Coldfusion Session Scope Be Accessed from CFWindow

Is there any reason why I can't access the SESSION and APPLICATION scope from within CFWindow?

I've got this on a page:

<img src="images/myPic.gif" border="0"
   onclick="ColdFusion.Window.create('myWindow+#uniqueid#','Alert!','',{x:100,y:100,height:300,width:400,modal:true,closable:false,draggable:false,resizable:false,center:true,_cf_refreshOnShow:true})" />

Then on WindowData.cfm no SESSION and APPLICATION variables can be accessed.

Is this appopriate behaviour for CFWindow or am I just nuts? I don't see a reason why I shouldn't access these scopes.

Who is Participating?
Nope. As long as the page you're opening is covered by your Application.cfc/cfm there's shouldn't be any reason you can't access session/application variables. Are you getting an error?

....  is the URL you're opening part of the same domain?

You can try using a relative reference ....

....'Alert!','/model/WindowData.cfm?userID=#Uniqueid#', .....
Garbonzo_HorowitzAuthor Commented:

@ agx

I get this error message from the WindowData page:
Variable SESSION is undefined.
Variable APPLICATION is undefined.
Whenever I dump those vars on the page.

 @ gdemaria

I changed the code to use a relative reference but I still get the APPLICATION undefined error.

I can dump the session and application scope on the page that contains the WindowCreate and it shows up just fine but when I try it on the WindowData page it does not recognize those scopes.

The framework that I'm using is a modified Fusebox where all pages go through a main ciruct. That really shouldn't matter though.

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

what happens if you try to SET a session variable, do you get an error?

<cfset session.myTest = "123">


 is there any chance of a 2nd application.cfc or .cfm file in your directories?

Garbonzo_HorowitzAuthor Commented:
It turns out that the issue was framwork related.
Thats what you get when working with a roll-your-own framwork.
Since the WidnowData page was not passing through the main circut none of the setup was being done.

Both of the responses were accurate and useful so I'm splitting the points for both.

Garbonzo_HorowitzAuthor Commented:
Thank you.
Sure, glad you figured it out.

But it seems if your application file is in your root, then it wouldn't matter where the file was ...   you may want to be sure your application file is in the root..
  > But it seems if your application file is in your root, then it wouldn't matter where the file was ...  

Yeah, that's what I was thinking.  Unless maybe this "setup" code is done inside the main circuit and not inside the Application.cfc/cfc file ...?
Wait scratch that ... even if some variables were being set inside the main circuit, the base scopes (application, session) would still be available. ie You'd get a different error.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.