9 Replies Latest reply on Aug 23, 2006 12:09 PM by Archie777

    CGI.JSessionId is same with new instance of FireFox

    Archie777
      I am developing a CF MX7 application.
      I want a user to be able to have multiple sessions open from the same client machine.
      I use CGI.JSessionId as a key to my database session state handling. In IE6 it works just fine. When the user opens a new browser window there is a new CGI.JSession Id
      With Firefox 1.5 when a new tab is opened or when a whole new instance of the browser is started it has the same CGI.JSessionId. This is my problem With Firefox the user only can have one active session.
      Any thoughts would be greatly appreciated.
      Thankd
      Archie Campbell
        • 1. Re: CGI.JSessionId is same with new instance of FireFox
          <newbie />

          I have never done anything what you have described nor have I heard of anyone
          doing something similar.

          I would be interested to hear how others have solved a problem similar to yours.

          My first reaction to a possible solution is pretty messy and not even viable.

          But here it is anyway...

          Persist a new URL or FORM variable/token on every page called such that new
          browser windows would necessarily not have this variable in the URL or
          FORM scope. Leave this token in the URL/FORM scope and don't assign or
          create a similarly named token in the SESSION or COOKIE, etc.

          Meaning, if CF receives a page request and the URL/FORM token does not
          exist, then it must mean that the user has opened another browser.

          For this to work, you must persist the token's value on every
          page/link/submit/etc. the user makes. You will also need to come up with a way
          of generating universally unique token values. ( consider CreateUUID() )

          You should now have a new token to use in place of or in addition to jsessionid.

          Good luck!
          • 2. Re: CGI.JSessionId is same with new instance of FireFox
            Archie777 Level 1
            The more I think about the situation I have encountered the more I conclude either:
            1. IE (Microsoft) is doing it right and Firefox is doing it wrong, or
            2. ColdFusion works better with IE than with Firefox.

            I know, both comments are blasphemous.
            But I live in a free country and its my story and I am sticking to it ;-)
            • 3. Re: CGI.JSessionId is same with new instance of FireFox
              Kronin555 Level 1
              Archie,

              Do you have cookies disabled in IE? We use Java session variables on our sites and IE and Firefox both act the same, a single session for all browser instances. If you disable cookies, then session tracking is done via URL rewriting (and you need to be sure to append it to the end of every link on your site, otherwise you lose session information). When session tracking is done via URL rewriting, each browser window, or tab, or whatever can have its own session.

              When it's tracked via cookies, then all browser windows share the same session.
              • 4. Re: CGI.JSessionId is same with new instance of FireFox
                Archie777 Level 1
                re: "We use Java session variables on our sites and IE and Firefox both act the same, a single session for all browser instances."
                Well they dont for me. From the same WinXP client machine, if I open another instance of IE 6 it gets a different CGI.JSessionID.
                • 5. Re: CGI.JSessionId is same with new instance of FireFox
                  Kronin555 Level 1
                  huh. nevermind.

                  If you do a File->New->Window, you get the same session. If you open another IE window by starting the program again, you get a different session.

                  All other browsers work the Firefox way. Why IE does it differently, and does it differently based on how you get 2 windows open, is anyone's guess... The big question is, how does IE7 handle it?
                  • 6. Re: CGI.JSessionId is same with new instance of FireFox
                    Level 7
                    Interesting enough...IE7 B3 maintains the session regardless if you open
                    a new window (CTRL-N), or open a new tab (CTRL-T), however, if I start a
                    new instance from the Quick Launch Toolbar IE Icon, I get a new session
                    ...at least on my Dev machine WinXP Pro IE7 b3, CFMX 7.02, J2EE sessions
                    HTH
                    --
                    Tim Carley
                    www.recfusion.com
                    info@NOSPAMINGrecfusion.com
                    • 7. Re: CGI.JSessionId is same with new instance of FireFox
                      Archie777 Level 1
                      1. re: "If you do a File->New->Window, you get the same session. If you open another IE window by starting the program again, you get a different session."
                      That is just plain silly.

                      2. re: "All other browsers work the Firefox way" I would change the emphasis from the browser to ColdFusion. I would want ColdFusion to create a separate jSessionId for each new browser instance whether it be a new Windows, a new Start Program, or just a new tab in Firefox. Otherwise the sessions are going to clobber each other.

                      I think what I am asking for is a simple way of doing multi-tasking at the client level. If ColdFusion treated the other browser sessions like it treats an IE6 new instance I would be happy.

                      Thanks
                      Archie
                      • 8. Re: CGI.JSessionId is same with new instance of FireFox
                        Kronin555 Level 1
                        Archie,

                        If you're using J2EE session management, it isn't Coldfusion that is or isn't handling it "correctly", it's JRun. All J2EE servers handle this the same way. Sessions are tracked via cookie unless cookies are disabled, then it falls back to URL rewriting, but you need to make sure you tack it onto the end of all your links, form posts, etc.

                        Because it uses a cookie to track sessions, the browser would need to keep per-window-instance or per-tab-instance cookies rather than application-wide cookies. My guess is when you open a new IE instance from the Start menu, it starts with no transient cookies. When you do File->New->Window, it inherits the transient cookies of the parent Window. All other browsers all have shared transient cookies across all instances and tabs.

                        As I already said, if you want per-window-instance or per-tab-instance sessions, you need to track your sessions using URL rewriting.
                        • 9. Re: CGI.JSessionId is same with new instance of FireFox
                          Archie777 Level 1
                          Kronin555
                          I think I got it now.
                          Much appreciate your clearly worded comments.
                          Thanks
                          Archie