public static void CreateAndConfigureLocalApplicationPoolAndVirtualDirectory(string physicalPath, string clrConfigFilePath, string applicationPoolName, string siteName, string virtualPath, string sslFlags, MultiValuedProperty <AuthenticationMethod> iisAuthenticationMethods)
        {
            bool flag  = false;
            bool flag2 = false;

            using (ServerManager serverManager = new ServerManager())
            {
                bool flag3 = false;
                flag3 |= IISConfigurationUtilities.CreateOrUpdateApplicationPool(serverManager, applicationPoolName, clrConfigFilePath, out flag2);
                flag3 |= IISConfigurationUtilities.ConfigureApplication(serverManager, siteName, applicationPoolName, virtualPath, physicalPath, out flag);
                flag3 |= IISConfigurationUtilities.UpdateAuthenticationSettingsAndProviders(serverManager, siteName, virtualPath, iisAuthenticationMethods);
                flag3 |= IISConfigurationUtilities.SetSslFlags(serverManager, siteName, virtualPath, sslFlags);
                if (flag3)
                {
                    serverManager.CommitChanges();
                }
            }
            using (ServerManager serverManager2 = new ServerManager())
            {
                bool flag4 = IISConfigurationUtilities.UpdateAuthenticationModules(serverManager2, siteName, virtualPath, iisAuthenticationMethods, false);
                if (flag4)
                {
                    serverManager2.CommitChanges();
                }
                if (flag)
                {
                    IISConfigurationUtilities.TryRecycleApplicationPool(serverManager2, applicationPoolName);
                }
            }
        }
 public static void UpdateRemoteVirtualDirectory(string remoteServerName, string siteName, string virtualPath, MultiValuedProperty <AuthenticationMethod> iisAuthenticationMethods)
 {
     using (ServerManager serverManager = ServerManager.OpenRemote(remoteServerName))
     {
         bool flag = IISConfigurationUtilities.UpdateAuthenticationSettingsAndProviders(serverManager, siteName, virtualPath, iisAuthenticationMethods);
         if (flag)
         {
             serverManager.CommitChanges();
         }
     }
     using (ServerManager serverManager2 = ServerManager.OpenRemote(remoteServerName))
     {
         bool flag2 = IISConfigurationUtilities.UpdateAuthenticationModules(serverManager2, siteName, virtualPath, iisAuthenticationMethods, false);
         if (flag2)
         {
             serverManager2.CommitChanges();
         }
     }
 }
        internal static bool UpdateAuthenticationSettings(ServerManager serverManager, string siteName, string virtualPath, MultiValuedProperty <AuthenticationMethod> authMethods)
        {
            bool flag = IISConfigurationUtilities.UpdateAuthenticationSettingsAndProviders(serverManager, siteName, virtualPath, authMethods);

            return(flag | IISConfigurationUtilities.UpdateAuthenticationModules(serverManager, siteName, virtualPath, authMethods, true));
        }