Skip to main content
Inspiring
April 24, 2007
Answered

Session variables being lost

  • April 24, 2007
  • 1 reply
  • 653 views
In my onApplicationStart method (which should tell you I'm using an Application.cfC, not cfM), I have a cfif loop that passes a value to a custom tag and returns a form variable. I'm then reassigning that variable to a session variable. In IE, this works just fine; in Firefox, though, the session variable is NOT being set.

What might be causing this, and is there a workaround?
    This topic has been closed for replies.
    Correct answer pblecha
    The issue referred to an external CF custom tag, which called another demo application to set a testing user. However, after further testing, I realize that demo app won't function properly with this application, so I've removed it.

    Authentication is being set by an LDAP query; this application that I am working on is going to be a sub-application of a larger application, and the authenticated user is being set as a session variable as well (I think...). However, I'm creating a new session variable for this application, and simply passing the authenticated user into my app (the outer app uses the variable auth_user; I'm using the variable authuser, so there is no name conflict).

    Again, it is IE that is not persisting the session. Firefox is doing so. I have looked in the advanced settings for IE, and there is nothing about persisting session variables to check or uncheck. Also, this application will probably be used mostly by users using IE 6 with default settings, so I'm going to need to find a workaround for IE.

    Your help is most appreciated.

    I found the answer.

    I simply attached the URLToken to my URL on my page call, and the session variable passed with no problem.

    1 reply

    Inspiring
    April 25, 2007
    post your code.

    i suspect the problem is that IE does not treat application properly:
    if you set anything in onApplicationStart in your Application.cfc it
    will be set ONLY ONCE when the application starts. to make the
    onApplicationStart fire again, you either have to restart the CF service
    or call the method as a function from a cfscript.

    i believe FF is doing things exactly how they should be done, while IE
    does its own tricks...

    anyway, why not set your session var in onSessionStart instead of
    onApplicationStart?
    --

    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com
    pblechaAuthor
    Inspiring
    April 25, 2007
    I just looked back at my code; I am in fact instantiating the session structure object variable in the onSessionStart() method.

    FireFox does persist the structure; but I'm having an issue accessing it after I set permission levels for the application.

    IE is not persisting the values in the structure from one form to the next, which is very very frustrating, since I'm actually using a wrapper index page and a cfinclude to bring in each form.

    UPDATED: The code I had in my onSessionStart follows. There are two custom tags here: cf_demouser creates a form from which to choose from the company user list; it returns a form.username variable; cf_assignrole takes the acctno of the AuthUser from the query and assigns one of eight roles; the only roles that are authorized here are divisionmgr and manager.

    This code executes perfectly outside of the onSessionStart() method, but it does NOT execute the same way in that method. Are there limitations to queries or variables in the onSessionStart()? If so, why are these not in LiveDocs???