4 Replies Latest reply on Jan 28, 2008 11:16 AM by iKnowKungFoo

    session variables is not recognized in my CFC

    cyber fyb Level 1

      I got a very weird problem today! I have created a simple login page ( username as an email and a password). This is post to the same page where I verify from a query if the username and password are valid. Once the query returns a RecordCount greater than 0, I create session variables to store the first name and last name of the user. I can see actually the session variables from a CFDUMP at that level.

      Since I am developping an application that will mix ColdFusion (mostly CFC) and Flex 3, I have created a CFC where I store functions needed for the Flex application. One of the function is fGetUserInfo where I try to collect the information I previously store in the session scope from the login - such as the first name. The system stop right there with an error saying that the session variables are not defined while I have the session variables appear at the bottom of the debug information in the same page. This is starting to be over my knowledge and I must missing an information to resolve this - in other words, I need your help!!!

      I include some code to understand that the problem is not a mispelling!!! ;-))

        • 1. session variables is not recognized in my CFC
          cyber fyb Level 1
          I tried to change the savings of the user's information into cookies instead of the session scope but it does the exact same error (except it says Element TECHNICIANID is undefined in COOKIE).

          In fact, after a little break, I started to think about the method to access the functions inside the CFC. As it is remote, I though that it might have a sense of no life on the session scope. Than I though about the idea to transfer all the informations to the client with Cookie. CFCOOKIE work fine and I was kind of animated by my idea! I coded, I tried and it failed. I used at first the default value of the CFCOOKIE which consists to reside on the memory like a session but disapear when the user close his/her browser. So after the first fail I change the expiration for 30 minutes but it failed again and for the same reason: Element TECHNICIANID is undefined in COOKIE.

          • 2. Re: session variables is not recognized in my CFC
            Dan Bracuk Level 5
            A well written cfc will not use any variables except those it declares itself or those that are passed to as arguments. This goes double for webservices where the invoking application may not be written in Cold Fusion.
            • 3. Re: session variables is not recognized in my CFC
              cyber fyb Level 1
              Thank you Dan but you are not helping me with this! I am struggling to get values from a CFC in order to get a "kind" of session scope information for the user while I am trying to developping the application in Flex and there is a lack of information for dealing with that scope! Flex cannot talk to the ColdFusion session's variables directly so it needs to use a web service instead. I also did not find any method at this moment to read cookies as well (which is really difficult to believe for me).

              Since the application is mixed with ColdFusion and Flex, I am not so worry at this moment for the implication of using wider range of variables into a function used as a web service beause the application will be office use only and I must find a solution soon to unblock the security part.

              I will otherwise agree with you but in this case, I do not see any other choice!!!
              • 4. session variables is not recognized in my CFC
                iKnowKungFoo Level 1
                Have you tried returning the whole session scope from the web service to test that the variables you're asking for exist at the time of the call?

                <cffunction name="fGetUserInfo" access="remote" returntype="struct">
                <cfreturn session />