4 Replies Latest reply on Dec 6, 2006 6:27 PM by doug777

    Application Variables in a Shared Server Environment

    doug777 Level 1
      My application looks rather like a shared server environment where different groups of users connect to different databases while all using the same cfm pages.

      Is there a way to have an Application scope that is different for each group of users?

      Or how is this achieved on a typical web shared server?

      Doug
        • 1. Re: Application Variables in a Shared Server Environment
          MikerRoo Level 1
          There is only one Application scope.

          For variables that are group specific, use the Client Scope.
          • 2. Re: Application Variables in a Shared Server Environment
            doug777 Level 1
            Thanks very much and that seems to be the way to go, but can you help me to understand how things work on a shared server: -

            How is it possible that on my website host's shared server for example, I can set any application variable I like and use onApplicationStart and they all apply only to my website, when there are dozens of other users all sharing ColdFusion?

            Doug

            • 3. Re: Application Variables in a Shared Server Environment
              MikerRoo Level 1
              First, if your host is any good at all, all the different hosting clients are not strictly sharing CF.

              The host should be using CF Enterprise and running each client in their own instance.

              Anyway, the application variables are controlled by the cfapplication tag or by the Application.cfc name value.

              On a given server instance, each application name has its own Application scope.

              Since a given set of files can only use one App tag or App cfc, they can only have one Application scope.

              Anyway, the values you want are NOT constant throughout the application so they don't belong in the application scope per se.

              Unless, maybe, you did something like this:

              Application.UsrGroups[1].name = grunts
              Application.UsrGroups[1].datasource = grunt_DB
              Application.UsrGroups[2].name = Bosses
              Application.UsrGroups[2].datasource = Boss_DB
              etc.


              But it is still probably cleaner to set the key values in the Client scope.
              • 4. Re: Application Variables in a Shared Server Environment
                doug777 Level 1
                Thanks so much for your time. I can now fully understand what is going on and you're right the Client scope does provide exactly what I want.

                Many thanks,
                Doug