Ok... I keep getting a "Variable SESSION is undefined" error when I do
this...
I have two functions in my .CFC -- setSessionVar and getSessionVar
setSessionVar has the following:
<cfset SESSION[ARGUMENTS.var_name] = TRIM(ARGUMENTS.var_value) />
(obviously var_name and var_value are arguments I pass in)
getSessionVar has the following:
<cfset var returnValue = "" />
<cfif StructKeyExists(SESSION, ARGUMENTS.var_name)>
<cfset returnValue = SESSION[ARGUMENTS.var_name] />
</cfif>
Now, the setSessionVar runs fine. Further, if I actually create a return
variable in the setSessionVar function and I assign the value of
SESSION[ARGUMENTS.var_name] to that return variable, I don't get any errors
and it returns exactly the data I sent.
Only when I call the getSessionVar function do I get the "Variable SESSION
is undefined" error...
On Ben Forta's blog, (here:
forta.com/blog/index.cfm/2007/11/15/Flex-And-ColdFusion-Session-Variables )
I found that someone was having the same problem I'm having with the
SESSION undefined errors, and Ben's advice was "it means that the
CFID/CFTOKEN or jsessionid cookies/URL parameters are not being passed, and
need to be." So where the heck do I get this information from, and where
do I pass it to?
HELP! I R CONFUSED! :-)
Thanks,
L.
On Thu, Sep 13, 2012 at 9:10 AM, Scott Talsma <[email protected]> wrote:
> You already have everything you need basically.
>
> 1) Turn on session management in your cf application (it's probably
> already on)
> 2) In onSessionStart in app.cfc,
> session.isUserAuthenicated = false;
> 3) In your login routine, when the user successfully logs in, add a line:
> session.isUserAuthenicated = true
> 4) Add a new remote method in your authentication cfc
> function isUserAuthenicated() {
> return session. isUserAuthenicated;
> }
>
> 5) In your 2nd flex app, call your cfc. isUserAuthenicated(). If it
> returns true, proceed, otherwise bail. The session information is
> preserved on the server, so both apps will see it.
>
>
> On Wed, Sep 12, 2012 at 7:38 PM, Laurence MacNeill <[email protected]
> > wrote:
>
>> Oh, yeah -- I'm using that login system there, but it doesn't create
>> session ID's... It just verifies the user-name and password is valid (thru
>> an HTTPS connection, of course). Once it's been validated, the program
>> runs as usual... The first thing that pops up when you run my existing
>> Flex program is the login window, so you can't do anything until you log
>> in...
>>
>> What I'm trying to do now is, within that existing program, call another
>> Flex program in another window -- but I don't want the user to have to log
>> in again, and I don't want to pass the user-name and password thru a
>> URL... And I don't want this new Flex program to be accessible to anyone
>> other than someone who's already logged into my existing Flex program, or
>> into the web-site (which uses ColdFusion sessions to "remember" that
>> they've already logged in.)
>>
>> So I'm trying to figure out how to create a ColdFusion session from
>> within a Flex program, I guess... Anyone ever done that?
>>
>> Thanks,
>> L.
>>
>>
>>
>> On Mon, Sep 10, 2012 at 10:45 AM, Douglas Knudsen <
>> [email protected]> wrote:
>>
>>> a couple posts on this to get started, one you might recall even :)
>>>
>>>
>>> http://cookbooks.adobe.com/post_Popup_Flex_login_with_ColdFusion_backend-12346.html
>>>
>>>
>>> http://www.brucephillips.name/blog/index.cfm/2007/3/17/Login-System-For-A-Flex-Application-With-ColdFusion-Backend-Part-2--Flex--ColdFusion-Connectivity
>>>
>>>
>>>
>>> Douglas Knudsen
>>> http://www.cubicleman.com
>>> this is my signature, like it?
>>>
>>>
>>>
>>> On Mon, Sep 10, 2012 at 9:46 AM, Laurence MacNeill <
>>> [email protected]> wrote:
>>>
>>>> Well, we are running ColdFusion 9, so I guess I'll check out how to
>>>> create a session on CF9.
>>>>
>>>> Thanks,
>>>> L.
>>>> On Sep 10, 2012 8:33 AM, "Scott Talsma" <[email protected]> wrote:
>>>>
>>>>> The server session approach will require an application server (PHP,
>>>>> CF, .net, java, etc.).
>>>>> http://en.wikipedia.org/wiki/Session_(computer_science)
>>>>>
>>>>> On Sun, Sep 9, 2012 at 4:33 PM, Laurence MacNeill <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> The server session sounds like something I'd prefer over the browser
>>>>>> cookie... How would I go about creating a server session in a Flex
>>>>>> program, though?
>>>>>>
>>>>>> Thanks,
>>>>>> L.
>>>>>>
>>>>>>
>>>>>> On Sunday, September 9, 2012, Scott Talsma wrote:
>>>>>>
>>>>>>> I would approach this via a session. The user gets an authentication
>>>>>>> token when they enter the correct way. You could save this in the server
>>>>>>> session (if you have a server) or simply as a browser session cookie.
>>>>>>> Your
>>>>>>> 2nd app checks for a vald session when it starts.
>>>>>>>
>>>>>>> On Sunday, September 9, 2012, Laurence MacNeill wrote:
>>>>>>>
>>>>>>>> I have a Flex program that I only want users to be able to access
>>>>>>>> if they're already inside a different Flex program I wrote, or inside a
>>>>>>>> web-page on my server.
>>>>>>>>
>>>>>>>> Is there a way, within that Flex program to which I want to
>>>>>>>> restrict access, to tell the URL or server *from* which it was called?
>>>>>>>>
>>>>>>>> In other words, If someone types
>>>>>>>> http://www.mydomain.com/MyRestrictedFlexProgram.html directly into
>>>>>>>> their browser, I want the program to tell the user they don't have
>>>>>>>> access
>>>>>>>> -- BUT if a different Flex program (or a web-page) on my server calls
>>>>>>>> that
>>>>>>>> URL, I want my restricted-access Flex program to go ahead and run
>>>>>>>> normally...
>>>>>>>>
>>>>>>>> Thanks for any help you can give me.
>>>>>>>> Laurence MacNeill
>>>>>>>> Mableton, Georgia, USA
>>>>>>>>
>>>>>>>>
>>>>>
>>>
>>
>