internal static bool SetSslFlags(ServerManager serverManager, string siteName, string virtualPath, string sslFlags)
        {
            string               text = siteName + virtualPath;
            Configuration        applicationHostConfiguration = serverManager.GetApplicationHostConfiguration();
            ConfigurationSection section = applicationHostConfiguration.GetSection("system.webServer/security/access", text);

            return(IISConfigurationUtilities.UpdateSectionAttribute(section, "sslFlags", sslFlags));
        }
        internal static bool UpdateAuthenticationSettingsAndProviders(ServerManager serverManager, string siteName, string virtualPath, MultiValuedProperty <AuthenticationMethod> authMethods)
        {
            bool                 flag = false;
            string               text = siteName + virtualPath;
            Configuration        applicationHostConfiguration = serverManager.GetApplicationHostConfiguration();
            ConfigurationSection section = applicationHostConfiguration.GetSection("system.webServer/security/authentication/anonymousAuthentication", text);

            flag   |= IISConfigurationUtilities.UpdateSectionAttribute(section, "enabled", false);
            section = applicationHostConfiguration.GetSection("system.webServer/security/authentication/basicAuthentication", text);
            bool flag2 = authMethods.Contains(AuthenticationMethod.Basic);

            flag   |= IISConfigurationUtilities.UpdateSectionAttribute(section, "enabled", flag2);
            section = applicationHostConfiguration.GetSection("system.webServer/security/authentication/clientCertificateMappingAuthentication", text);
            flag2   = authMethods.Contains(AuthenticationMethod.Certificate);
            flag   |= IISConfigurationUtilities.UpdateSectionAttribute(section, "enabled", flag2);
            section = applicationHostConfiguration.GetSection("system.webServer/security/authentication/digestAuthentication", text);
            flag2   = authMethods.Contains(AuthenticationMethod.Digest);
            flag   |= IISConfigurationUtilities.UpdateSectionAttribute(section, "enabled", flag2);
            section = applicationHostConfiguration.GetSection("system.webServer/security/authentication/iisClientCertificateMappingAuthentication", text);
            flag   |= IISConfigurationUtilities.UpdateSectionAttribute(section, "enabled", false);
            section = applicationHostConfiguration.GetSection("system.webServer/security/authentication/windowsAuthentication", text);
            bool flag3 = authMethods.Contains(AuthenticationMethod.Negotiate);
            bool flag4 = authMethods.Contains(AuthenticationMethod.Kerberos);
            bool flag5 = authMethods.Contains(AuthenticationMethod.Ntlm);
            bool flag6 = authMethods.Contains(AuthenticationMethod.LiveIdNegotiate);

            flag2 = (flag3 || flag4 || flag5 || flag6);
            flag |= IISConfigurationUtilities.UpdateSectionAttribute(section, "enabled", flag2);
            flag |= IISConfigurationUtilities.UpdateSectionAttribute(section, "useKernelMode", false);
            if (flag2)
            {
                ConfigurationElementCollection collection = section.GetCollection("providers");
                int  num   = (flag3 ? 1 : 0) + (flag4 ? 1 : 0) + (flag5 ? 1 : 0);
                bool flag7 = false;
                if (collection.Count != num)
                {
                    flag7 = true;
                }
                else
                {
                    int num2 = 0;
                    if (flag6)
                    {
                        flag7 |= ((string)collection[num2].Attributes["value"].Value != "Negotiate:MSOIDSSP");
                        num2++;
                    }
                    if (flag3)
                    {
                        flag7 |= ((string)collection[num2].Attributes["value"].Value != "Negotiate");
                        num2++;
                    }
                    if (flag4)
                    {
                        flag7 |= ((string)collection[num2].Attributes["value"].Value != "Negotiate:Kerberos");
                        num2++;
                    }
                    if (flag5)
                    {
                        flag7 |= ((string)collection[num2].Attributes["value"].Value != "NTLM");
                        num2++;
                    }
                }
                if (flag7)
                {
                    flag = true;
                    collection.Clear();
                    if (flag6)
                    {
                        ConfigurationElement configurationElement = collection.CreateElement("add");
                        configurationElement["value"] = "Negotiate:MSOIDSSP";
                        collection.Add(configurationElement);
                    }
                    if (flag3)
                    {
                        ConfigurationElement configurationElement2 = collection.CreateElement("add");
                        configurationElement2["value"] = "Negotiate";
                        collection.Add(configurationElement2);
                    }
                    if (flag4)
                    {
                        ConfigurationElement configurationElement3 = collection.CreateElement("add");
                        configurationElement3["value"] = "Negotiate:Kerberos";
                        collection.Add(configurationElement3);
                    }
                    if (flag5)
                    {
                        ConfigurationElement configurationElement4 = collection.CreateElement("add");
                        configurationElement4["value"] = "NTLM";
                        collection.Add(configurationElement4);
                    }
                }
            }
            return(flag);
        }