3 Replies Latest reply on Dec 3, 2008 8:52 PM by fober1

    Session variable problem

    Hagster
      Hello All,

      I have two PCs on a network that get there session variables mixed up... read on

      Scenario
      In my application a few session variables are set up on the first page and then as the user progress through about 5 pages the session variables are called and used etc, until the last page when they are all set back to blank and the application starts again. (no problems there all works fine)

      Now I have about 30 PC's on the network all using this application at the same time, as you would expect each PC creates its own session variables allowing it to progress through its version of the application, with no problems. (and it works fine)

      Today I used an imaging application to make an image of one of my network PCs hard drives and then put another PC onto my network that was configured from the image, Is it this that has caused my problem?

      I can start the application on one PC go half the way through it, then jump onto the other PC (the imaged hard drive) start the application with different values, return to the first PC and continue only to find it is now using the session variable values from the second PC.

      Cold fussion docs says that 'Sessions are specific to both the individual client and the application' so im assuming because i cloned a PC hard drive to put another on the network the client OS (windows) and application (internet explorer) are the same and therefore causing my session variables to get mixed up between these two PCs.

      Any ideas how to correct this?
      How can you change the client identification within windows etc....

      Kind Regards Guy


        • 1. Re: Session variable problem
          fober1 Level 1
          hi,

          Each PC is identified by a session ID that is saved in a cookie, which
          you obviously copied in your image to the new PC as well.

          If you just want to fix this immediate issue, then clear your browser cache and delete your cookies.

          To avoid this issue going forward you can setup the live-time of the session cookies to a shorter period of time (as example to 0:00:00 so they immediately expire once the browser on a PC is closed.

          cheers,
          fober

          <cfapplication
          name= "mysite"
          sessionmanagement= "Yes"
          sessiontimeout= "#CreateTimeSpan(1,0,0,0)#"
          applicationtimeout= "#CreateTimeSpan(1,0,0,0)#"
          >


          • 2. Re: Session variable problem
            Hagster Level 1
            Hello fober1,

            Thanks you pointed me in the correct direction, but my resolve was a little different.
            It seems the browser settings were set up to use persistent cookies (stored on local hard drive) if I un-tick this setting and configure the browser to only use session cookies (in memory) I thought this would solve the problem because it would generate a unique cfid, cftoken etc each time a the browser was opened, but it does not work.
            When on session cookies are enabled on the browser it forgets all session variables in cold fussion when moving to the next page in my application (which I dont really understand if this is correct or not)

            So to get it working all I did was to turn back on persistent cookies and delete all cookie files on the hard drive so it generated a new unique one.

            Question.
            Should I be able to run a browser and have persistent cookies turned off, and only session cookies enabled to hold the cookies in memory and not the local hard drive?

            Kind Regards Guy

            • 3. Re: Session variable problem
              fober1 Level 1
              Hi,

              You can disable session cookies in cfapplication, and manually write the cookie using the cfcookie tag. This way you can set them to immediately expire when the browser is closed.

              http://www.dreamincode.net/code/snippet45.htm

              cheers,
              fober

              btw.I hope you appreciate to get this advice for free :-) I've just seen a website where they charge you $4 bugs for it !!!
              http://www.communitymx.com/abstract.cfm?cid=3AA99
              (went away to count how much money he could have already made here)