internal static void ConfigureAuthenticationService(ref StringBuilder sb, HttpContext context, ScriptManager scriptManager, List <ScriptManagerProxy> proxies)
        {
            string authServiceUrl = null;
            AuthenticationServiceManager authManager;

            if (scriptManager.HasAuthenticationServiceManager)
            {
                authManager = scriptManager.AuthenticationService;

                // get ScriptManager.ServiceUrl
                authServiceUrl = authManager.Path.Trim();
                if (authServiceUrl.Length > 0)
                {
                    authServiceUrl = scriptManager.ResolveUrl(authServiceUrl);
                }
            }

            // combine proxy ServiceUrls (find the first one that has specified one)
            if (proxies != null)
            {
                foreach (ScriptManagerProxy proxy in proxies)
                {
                    if (proxy.HasAuthenticationServiceManager)
                    {
                        authManager = proxy.AuthenticationService;

                        // combine urls
                        authServiceUrl = ApplicationServiceManager.MergeServiceUrls(authManager.Path, authServiceUrl, proxy);
                    }
                }
            }
            AuthenticationServiceManager.GenerateInitializationScript(ref sb, context, scriptManager, authServiceUrl);
        }
        internal static void ConfigureProfileService(ref StringBuilder sb, HttpContext context, ScriptManager scriptManager, List <ScriptManagerProxy> proxies)
        {
            string                profileServiceUrl = null;
            ArrayList             loadedProperties  = null;
            ProfileServiceManager profileManager;

            if (scriptManager.HasProfileServiceManager)
            {
                profileManager = scriptManager.ProfileService;

                // get ScriptManager.Path
                profileServiceUrl = profileManager.Path.Trim();
                if (profileServiceUrl.Length > 0)
                {
                    profileServiceUrl = scriptManager.ResolveClientUrl(profileServiceUrl);
                }

                // get ScriptManager.LoadProperties
                if (profileManager.HasLoadProperties)
                {
                    loadedProperties = new ArrayList(profileManager._loadProperties);
                }
            }

            // combine proxy Paths (find the first one that has specified one)
            // combine loadedProperties collection (take the union of all)
            if (proxies != null)
            {
                foreach (ScriptManagerProxy proxy in proxies)
                {
                    if (proxy.HasProfileServiceManager)
                    {
                        profileManager = proxy.ProfileService;

                        // combine urls
                        profileServiceUrl = ApplicationServiceManager.MergeServiceUrls(profileManager.Path, profileServiceUrl, proxy);

                        // combine LoadProperties
                        if (profileManager.HasLoadProperties)
                        {
                            if (loadedProperties == null)
                            {
                                loadedProperties = new ArrayList(profileManager._loadProperties);
                            }
                            else
                            {
                                loadedProperties = ProfileServiceManager.MergeProperties(loadedProperties, profileManager._loadProperties);
                            }
                        }
                    }
                }
            }

            ProfileServiceManager.GenerateInitializationScript(ref sb, context, scriptManager, profileServiceUrl, loadedProperties);
        }
        internal static void ConfigureRoleService(ref StringBuilder sb, HttpContext context, ScriptManager scriptManager, List <ScriptManagerProxy> proxies)
        {
            string             roleServiceUrl = null;
            bool               loadRoles      = false;
            RoleServiceManager roleManager;

            if (scriptManager.HasRoleServiceManager)
            {
                roleManager = scriptManager.RoleService;

                // load roles?
                loadRoles = roleManager.LoadRoles;

                // get ScriptManager.Path
                roleServiceUrl = roleManager.Path.Trim();
                if (roleServiceUrl.Length > 0)
                {
                    roleServiceUrl = scriptManager.ResolveClientUrl(roleServiceUrl);
                }
            }

            // combine proxy ServiceUrls (find the first one that has specified one)
            if (proxies != null)
            {
                foreach (ScriptManagerProxy proxy in proxies)
                {
                    if (proxy.HasRoleServiceManager)
                    {
                        roleManager = proxy.RoleService;

                        // combine load roles
                        if (roleManager.LoadRoles)
                        {
                            loadRoles = true;
                        }

                        // combine urls
                        roleServiceUrl = ApplicationServiceManager.MergeServiceUrls(roleManager.Path, roleServiceUrl, proxy);
                    }
                }
            }

            RoleServiceManager.GenerateInitializationScript(ref sb, context, scriptManager, roleServiceUrl, loadRoles);
        }