public bool RemoveModule(string moduleName)
        {
            bool result = true;

            using (ServerManager serverManager = GetServerManager())
            {
                Configuration                  config = serverManager.GetApplicationHostConfiguration();
                ConfigurationSection           globalModulesSection    = config.GetSection("system.webServer/globalModules");
                ConfigurationElementCollection globalModulesCollection = globalModulesSection.GetCollection();
                var globalModule = FindElement(globalModulesCollection, "add", "name", moduleName);
                if (globalModule != null)
                {
                    globalModulesCollection.Remove(globalModule);
                }
                ConfigurationSection           modulesSection    = config.GetSection("system.webServer/modules");
                ConfigurationElementCollection modulesCollection = modulesSection.GetCollection();
                var module = FindElement(modulesCollection, "add", "name", moduleName);
                if (module != null)
                {
                    modulesCollection.Remove(module);
                }

                serverManager.CommitChanges();
            }
            return(result);
        }
Пример #2
0
    protected void removeButton_Click(object sender, EventArgs e)
    {
        using (ServerManager serverManager = new ServerManager())
        {
            Configuration                  config  = serverManager.GetWebConfiguration(siteName);
            ConfigurationSection           section = config.GetSection("system.webServer/security/ipSecurity");
            ConfigurationElementCollection coll    = section.GetCollection();
            for (int i = 0; i < CheckBoxList1.Items.Count; i++)
            {
                if (CheckBoxList1.Items[i].Selected)
                {
                    ConfigurationElement removeElem = coll.Where(el => el.Attributes["ipAddress"].Value.ToString() == CheckBoxList1.Items[i].Text).FirstOrDefault();

                    if (removeElem != null)
                    {
                        coll.Remove(removeElem);
                    }
                }
            }

            serverManager.CommitChanges();

            CheckBoxList1.Items.Clear();
            for (int i = 0; i < coll.Count; i++)
            {
                CheckBoxList1.Items.Add(coll[i].Attributes["ipAddress"].Value.ToString());
            }
        }
    }
Пример #3
0
        public void EditRule()
        {
            using (var dialog = new AddMapDialog(Module, SelectedItem.SelectedItem, this))
            {
                if (dialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                var newItem = dialog.Item;
                var service = (IConfigurationService)GetService(typeof(IConfigurationService));
                ConfigurationElementCollection rulesCollection = SelectedItem.Element.GetCollection();

                if (SelectedItem.SelectedItem != newItem)
                {
                    SelectedItem.Items.Add(newItem);
                    SelectedItem.SelectedItem = newItem;
                }
                else if (newItem.Flag != "Local")
                {
                    rulesCollection.Remove(newItem.Element);
                    newItem.Flag = "Local";
                }

                newItem.AppendTo(rulesCollection);
                service.ServerManager.CommitChanges();
            }
            OnRewriteSettingsSaved();
            SelectedItem.OnRewriteSettingsSaved();
        }
Пример #4
0
        /// <summary>
        /// Removes a server to the WebFarm
        /// </summary>
        /// <param name="farm">The name of the WebFarm</param>
        /// <param name="address">The address of the server</param>
        /// <returns>If the server was removed.</returns>
        public bool RemoveServer(string farm, string address)
        {
            ConfigurationElement farmElement = this.GetFarm(farm);

            if (farmElement != null)
            {
                ConfigurationElementCollection servers = farmElement.GetCollection();
                ConfigurationElement           server  = servers.FirstOrDefault(f => f.GetAttributeValue("address").ToString() == address);

                if (server != null)
                {
                    servers.Remove(server);
                    _Server.CommitChanges();

                    _Log.Information("Removed server '{0}'.", address);
                    return(true);
                }
                else
                {
                    _Log.Information("The server '{0}' does not exists.", address);
                    return(false);
                }
            }

            return(false);
        }
        private bool ConfigureIsapiRestrictions(ServerManager mgr, string physicalPath, ModeType mode)
        {
            Configuration config = mgr.GetApplicationHostConfiguration();

            ConfigurationSection           isapiCgiRestrictionSection    = config.GetSection("system.webServer/security/isapiCgiRestriction");
            ConfigurationElementCollection isapiCgiRestrictionCollection = isapiCgiRestrictionSection.GetCollection();

            ConfigurationElement addElement =
                isapiCgiRestrictionCollection.FirstOrDefault(elem => string.Compare(elem.Attributes["path"].Value.ToString(), physicalPath, true) == 0);

            if (mode == ModeType.Deploy && addElement == null)
            {
                base.Log.LogMessage("Allowing ISAPI restriction '{0}'...", physicalPath);
                addElement            = isapiCgiRestrictionCollection.CreateElement("add");
                addElement["path"]    = physicalPath;
                addElement["allowed"] = true;
                isapiCgiRestrictionCollection.Add(addElement);
                mgr.CommitChanges();
                base.Log.LogMessage("Allowed ISAPI restriction '{0}'.", physicalPath);
            }
            else if (mode == ModeType.Undeploy && addElement != null)
            {
                base.Log.LogMessage("Disallowing ISAPI restriction '{0}'...", physicalPath);
                isapiCgiRestrictionCollection.Remove(addElement);
                mgr.CommitChanges();
                base.Log.LogMessage("Disallowed ISAPI restriction '{0}'...", physicalPath);
            }

            return(true);
        }
        public void ConfigureCustomLogging(string siteName, string appName, int statusCode, int subStatusCode, string path)
        {
            using (ServerManager serverManager = GetServerManager())
            {
                Configuration        config            = serverManager.GetWebConfiguration(siteName, appName);
                ConfigurationSection httpErrorsSection = config.GetSection("system.webServer/httpErrors");
                httpErrorsSection["errorMode"] = @"Custom";

                ConfigurationElementCollection httpErrorsCollection = httpErrorsSection.GetCollection();
                ConfigurationElement           errorElement         = FindElement(httpErrorsCollection, "error", "statusCode", statusCode.ToString(), "subStatusCode", subStatusCode.ToString());
                if (errorElement != null)
                {
                    httpErrorsCollection.Remove(errorElement);
                }

                ConfigurationElement errorElement2 = httpErrorsCollection.CreateElement("error");
                errorElement2["statusCode"]    = statusCode;
                errorElement2["subStatusCode"] = subStatusCode;
                errorElement2["path"]          = path;
                httpErrorsCollection.Add(errorElement2);

                serverManager.CommitChanges();
            }
            Thread.Sleep(500);
        }
Пример #7
0
        public void AddGroup()
        {
            using (var dialog = new AddCustomTagsDialog(Module))
            {
                if (dialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                var newItem      = dialog.Item;
                var service      = (IConfigurationService)GetService(typeof(IConfigurationService));
                var rulesSection = service.GetSection("system.webServer/rewrite/outboundRules");
                ConfigurationElementCollection rulesCollection = rulesSection.GetCollection("customTags");

                if (SelectedItem != newItem)
                {
                    Items.Add(newItem);
                    SelectedItem = newItem;
                }
                else if (newItem.Flag != "Local")
                {
                    rulesCollection.Remove(newItem.Element);
                    newItem.Flag = "Local";
                }

                newItem.AppendTo(rulesCollection);
                service.ServerManager.CommitChanges();
            }
            OnRewriteSettingsSaved();
        }
Пример #8
0
        public void Add()
        {
            var dialog = new AddMapsDialog(this.Module, this);

            if (dialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            var newItem      = dialog.Item;
            var service      = (IConfigurationService)this.GetService(typeof(IConfigurationService));
            var rulesSection = service.GetSection("system.webServer/rewrite/rewriteMaps");
            ConfigurationElementCollection rulesCollection = rulesSection.GetCollection();

            if (this.SelectedItem != newItem)
            {
                this.Items.Add(newItem);
                this.SelectedItem = newItem;
            }
            else if (newItem.Flag != "Local")
            {
                rulesCollection.Remove(newItem.Element);
                newItem.Flag = "Local";
            }

            newItem.AppendTo(rulesCollection);
            service.ServerManager.CommitChanges();
            this.OnRewriteSettingsSaved();

            this.Edit();
        }
Пример #9
0
        public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
        {
            SPSite site = properties.Feature.Parent as SPSite;

            if (site != null)
            {
                using (ServerManager manager = new ServerManager())
                {
                    try
                    {
                        Configuration                  webConfig         = manager.GetWebConfiguration("SharePoint - 80");
                        ConfigurationSection           modules           = webConfig.GetSection("system.webServer/modules");
                        ConfigurationElementCollection modulesCollection = modules.GetCollection();
                        foreach (ConfigurationElement module in modulesCollection)
                        {
                            if (String.Equals((string)module.GetAttributeValue("name"), VPPRegisterHandler, StringComparison.OrdinalIgnoreCase))
                            {
                                modulesCollection.Remove(module);
                                break;
                            }
                        }
                        manager.CommitChanges();
                    }
                    catch
                    {
                    }
                }
            }
        }
Пример #10
0
 internal static bool RemoveServers(string farmName, IEnumerable <string> endpoints)
 {
     using (ServerManager manager = new ServerManager()) {
         ConfigurationElementCollection webFarmsConfiguration = GetWebFarmsConfiguration(manager);
         ConfigurationElement           webFarm = GetWebFarmConfiguration(webFarmsConfiguration, farmName);
         if (webFarm != null)
         {
             ConfigurationElementCollection servers = webFarm.GetCollection();
             bool configurationChanged = false;
             foreach (string endPoint in endpoints)
             {
                 Dictionary <string, string> attributes = new Dictionary <string, string>()
                 {
                     { "address", endPoint }
                 };
                 ConfigurationElement serverConfiguration = ConfigurationElementUtils.FindElement(servers, "server", attributes);
                 if (serverConfiguration != null && ConfigurationElementUtils.HasAttribute(serverConfiguration, "address", endPoint))
                 {
                     servers.Remove(serverConfiguration);
                     configurationChanged = true;
                 }
             }
             if (configurationChanged)
             {
                 manager.CommitChanges();
             }
             return(true);
         }
     }
     return(false);
 }
Пример #11
0
        static void Main(string[] args)
        {
            ServerManager                  serverManager        = new ServerManager();
            Configuration                  config               = serverManager.GetApplicationHostConfiguration();
            ConfigurationSection           ipSecuritySection    = config.GetSection("system.webServer/security/ipSecurity", "Rela");
            ConfigurationElementCollection ipSecurityCollection = ipSecuritySection.GetCollection();
            List <string>                  blockedIpByService   = new List <string>();

            List <ConfigurationElement> listOfElements = new List <ConfigurationElement>();

            if (ipSecurityCollection.Count > 0)
            {
                foreach (var element in ipSecurityCollection)
                {
                    blockedIpByService.Add(element.Attributes[0].Value.ToString());
                    listOfElements.Add(element);
                }

                foreach (var element in listOfElements)
                {
                    ipSecurityCollection.Remove(element);
                }

                serverManager.CommitChanges();
            }
        }
Пример #12
0
        /// <summary>
        /// Removes the specified UI Module by name
        /// </summary>
        public static void RemoveUIModuleProvider(string name)
        {
            using (ServerManager mgr = new ServerManager())
            {
                // First remove it from the sites
                Configuration                  adminConfig    = mgr.GetAdministrationConfiguration();
                ConfigurationSection           modulesSection = adminConfig.GetSection("modules");
                ConfigurationElementCollection modules        = modulesSection.GetCollection();
                ConfigurationElement           module         = FindByAttribute(modules, "name", name);
                if (module != null)
                {
                    modules.Remove(module);
                }

                // now remove the ModuleProvider
                ConfigurationSection           moduleProvidersSection = adminConfig.GetSection("moduleProviders");
                ConfigurationElementCollection moduleProviders        = moduleProvidersSection.GetCollection();
                ConfigurationElement           moduleProvider         = FindByAttribute(moduleProviders, "name", name);
                if (moduleProvider != null)
                {
                    moduleProviders.Remove(moduleProvider);
                }

                mgr.CommitChanges();
            }
        }
Пример #13
0
    /// <summary>
    /// 给网站名称与后缀名
    /// </summary>
    public bool RemoveMimeElement(string siteName, string ext)
    {
        ConfigurationElementCollection ces = GetMimeTypeBySiteName(siteName);
        ConfigurationElement           ce  = GetMimeElementByExt(ext, ces);

        ces.Remove(ce);
        iis.CommitChanges();
        return(true);
    }
Пример #14
0
        public void RemoveGlobal(GlobalModule item)
        {
            this.GlobalModules.Remove(item);
            var service = (IConfigurationService)this.GetService(typeof(IConfigurationService));
            ConfigurationSection           globalSection    = service.GetSection("system.webServer/globalModules", null, false);
            ConfigurationElementCollection globalCollection = globalSection.GetCollection();

            globalCollection.Remove(item.Element);
            service.ServerManager.CommitChanges();
        }
Пример #15
0
        public virtual void RemoveItem()
        {
            this.Items.Remove(this.SelectedItem);
            var service = (IConfigurationService)this.GetService(typeof(IConfigurationService));
            ConfigurationElementCollection collection = GetCollection(service, SelectedItem);

            collection.Remove(this.SelectedItem.Element);
            service.ServerManager.CommitChanges();

            this.SelectedItem = default(T);
            this.OnSettingsSaved();
        }
Пример #16
0
 static void AllowIP(string IP)
 {
     using (ServerManager serverManager = new ServerManager())
     {
         Microsoft.Web.Administration.Configuration        config            = serverManager.GetApplicationHostConfiguration();
         Microsoft.Web.Administration.ConfigurationSection ipSecuritySection = config.GetSection("system.webServer/security/ipSecurity", "BrandsMarketing");
         ConfigurationElementCollection ipSecurityCollection = ipSecuritySection.GetCollection();
         var ipAddress = ipSecurityCollection.Where(x => x["ipAddress"].ToString() == IP).SingleOrDefault();
         ipSecurityCollection.Remove(ipAddress);
         serverManager.CommitChanges();
     }
 }
        private void AddElement(ConfigurationElementCollection appSettings, string key, string value)
        {
            if (appSettings.Any(t => t.GetAttributeValue("key").ToString() == key))
            {
                appSettings.Remove(appSettings.First(t => t.GetAttributeValue("key").ToString() == key));
            }

            var addElement = appSettings.CreateElement("add");

            addElement["key"]   = key;
            addElement["value"] = value;
            appSettings.Add(addElement);
        }
Пример #18
0
        /// <summary>
        /// Deletes the group access.
        /// </summary>
        /// <param name="siteName">Name of the site.</param>
        /// <param name="group">The group.</param>
        public static void DeleteGroupAccess(string siteName, string group)
        {
            using (ServerManager serverManager = new ServerManager())
            {
                Configuration config = serverManager.GetApplicationHostConfiguration();

                ConfigurationElementCollection authorization = config.GetSection("system.ftpServer/security/authorization", siteName).GetCollection();

                ConfigurationElement userAccess = authorization.Where(a => (string)a["roles"] == group).FirstOrDefault();

                authorization.Remove(userAccess);

                serverManager.CommitChanges();
            }
        }
Пример #19
0
        public static void DeleteWebFarm(string name)
        {
            using (var serverManager = new ServerManager())
            {
                Configuration config = serverManager.GetApplicationHostConfiguration();

                ConfigurationSection           section = config.GetSection("webFarms");
                ConfigurationElementCollection farms   = section.GetCollection();

                ConfigurationElement farm = farms.FirstOrDefault(f => f.GetAttributeValue("name").ToString() == name);

                if (farm != null)
                {
                    farms.Remove(farm);
                    serverManager.CommitChanges();
                }
            }
        }
Пример #20
0
        public virtual void EditItem(T newItem)
        {
            var service = (IConfigurationService)this.GetService(typeof(IConfigurationService));

            if (newItem.Flag != "Local")
            {
                ConfigurationElementCollection collection = this.GetCollection(service);
                collection.Remove(newItem.Element);
                newItem.AppendTo(collection);
                newItem.Flag = "Local";
            }
            else
            {
                newItem.Apply();
            }

            service.ServerManager.CommitChanges();
            this.OnSettingsSaved();
        }
Пример #21
0
        /// <summary>
        /// Delete an WebFarm
        /// </summary>
        /// <param name="name">The name of the WebFarm</param>
        /// <returns>If the WebFarm was deleted.</returns>
        public bool Delete(string name)
        {
            ConfigurationElementCollection farms = this.GetFarms();
            ConfigurationElement           farm  = farms.FirstOrDefault(f => f.GetAttributeValue("name").ToString() == name);

            if (farm != null)
            {
                farms.Remove(farm);
                _Server.CommitChanges();

                _Log.Information("WebFarm deleted.");
                return(true);
            }
            else
            {
                _Log.Information("The webfarm '{0}' does not exists.", name);
                return(false);
            }
        }
Пример #22
0
    private static void Main()
    {
        using (ServerManager serverManager = new ServerManager())
        {
            Configuration        config = serverManager.GetApplicationHostConfiguration();
            ConfigurationSection windowsAuthenticationSection = config.GetSection("system.webServer/security/authentication/windowsAuthentication", "Contoso");
            windowsAuthenticationSection["enabled"] = true;

            ConfigurationElementCollection providersCollection = windowsAuthenticationSection.GetCollection("providers");
            ConfigurationElement           addElement          = FindElement(providersCollection, "add", "value", @"Negotiate");

            if (addElement == null)
            {
                throw new InvalidOperationException("Element not found!");
            }
            providersCollection.Remove(addElement);

            serverManager.CommitChanges();
        }
    }
        internal static bool UpdateWebServerModule(ConfigurationElementCollection modulesCollection, string moduleName, string moduleType, bool shouldBeEnabled)
        {
            bool result = false;
            ConfigurationElement configurationElement = IISConfigurationUtilities.FindElement(modulesCollection, "add", "name", moduleName);

            if (shouldBeEnabled && configurationElement == null)
            {
                configurationElement         = modulesCollection.CreateElement("add");
                configurationElement["name"] = moduleName;
                configurationElement["type"] = moduleType;
                modulesCollection.Add(configurationElement);
                result = true;
            }
            else if (!shouldBeEnabled && configurationElement != null)
            {
                modulesCollection.Remove(configurationElement);
                result = true;
            }
            return(result);
        }
Пример #24
0
        public virtual void RemoveItem()
        {
            this.Items.Remove(this.SelectedItem);
            var service = (IConfigurationService)this.GetService(typeof(IConfigurationService));
            ConfigurationElementCollection collection = GetCollection(service, SelectedItem);

            try
            {
                collection.Remove(this.SelectedItem.Element);
            }
            catch (FileLoadException ex)
            {
                DisplayErrorMessage(ex, null);
                return;
            }

            service.ServerManager.CommitChanges();

            this.SelectedItem = default(T);
            this.OnSettingsSaved();
        }
Пример #25
0
        public bool DeleteWebDavRule(string organizationId, string folder, WebDavFolderRule rule)
        {
            using (ServerManager serverManager = new ServerManager())
            {
                Configuration config = serverManager.GetApplicationHostConfiguration();

                ConfigurationSection authoringRulesSection = config.GetSection("system.webServer/webdav/authoringRules", string.Format("{0}/{1}/{2}", _Setting.Domain, organizationId, folder));

                ConfigurationElementCollection authoringRulesCollection = authoringRulesSection.GetCollection();

                var toDeleteRule = authoringRulesCollection.FindWebDavRule(rule);

                if (toDeleteRule != null)
                {
                    authoringRulesCollection.Remove(toDeleteRule);
                    serverManager.CommitChanges();
                    return(true);
                }
                return(false);
            }
        }
Пример #26
0
        private void actRemove_Execute(object sender, EventArgs e)
        {
            var node = listView1.SelectedItems[0];

            node.Remove();
            var config = _server.GetApplicationHostConfiguration();
            ConfigurationSection           webFarmsSection    = config.GetSection("webFarms");
            ConfigurationElementCollection webFarmsCollection = webFarmsSection.GetCollection();
            ConfigurationElement           remove             = null;

            foreach (ConfigurationElement item in webFarmsCollection)
            {
                if (item["name"].ToString() == node.Text)
                {
                    remove = item;
                }
            }

            webFarmsCollection.Remove(remove);
            _form.RemoveFarmNode(node.Text);
        }
        public void CreateSite(string siteName, string physicalPath, int siteId, int tcpPort, string appPoolName = "DefaultAppPool")
        {
            TestUtility.LogInformation("Creating web site : " + siteName);

            using (ServerManager serverManager = GetServerManager())
            {
                Configuration                  config          = serverManager.GetApplicationHostConfiguration();
                ConfigurationSection           sitesSection    = config.GetSection("system.applicationHost/sites");
                ConfigurationElementCollection sitesCollection = sitesSection.GetCollection();
                ConfigurationElement           siteElement     = FindElement(sitesCollection, "site", "name", siteName);
                if (siteElement != null)
                {
                    sitesCollection.Remove(siteElement);
                }
                siteElement         = sitesCollection.CreateElement("site");
                siteElement["id"]   = siteId;
                siteElement["name"] = siteName;
                ConfigurationElementCollection bindingsCollection = siteElement.GetCollection("bindings");

                ConfigurationElement bindingElement = bindingsCollection.CreateElement("binding");
                bindingElement["protocol"]           = @"http";
                bindingElement["bindingInformation"] = "*:" + tcpPort + ":";
                bindingsCollection.Add(bindingElement);

                ConfigurationElementCollection siteCollection     = siteElement.GetCollection();
                ConfigurationElement           applicationElement = siteCollection.CreateElement("application");
                applicationElement["path"]            = @"/";
                applicationElement["applicationPool"] = appPoolName;

                ConfigurationElementCollection applicationCollection   = applicationElement.GetCollection();
                ConfigurationElement           virtualDirectoryElement = applicationCollection.CreateElement("virtualDirectory");
                virtualDirectoryElement["path"]         = @"/";
                virtualDirectoryElement["physicalPath"] = physicalPath;
                applicationCollection.Add(virtualDirectoryElement);
                siteCollection.Add(applicationElement);
                sitesCollection.Add(siteElement);

                serverManager.CommitChanges();
            }
        }
Пример #28
0
        /// <summary>
        /// Deletes an FTP virtual directory.
        /// </summary>
        /// <param name="name">The name of the virtual directory.</param>
        public static void DeleteFtpSite(string name)
        {
            using (ServerManager serverManager = new ServerManager())
            {
                Configuration config = serverManager.GetApplicationHostConfiguration();

                ConfigurationSection sitesSection = config.GetSection("system.applicationHost/sites");

                ConfigurationElementCollection sitesCollection = sitesSection.GetCollection();

                ConfigurationElement fileServiceSite = sitesCollection.FirstOrDefault(c => (string)c.Attributes["name"].Value == name);

                if (fileServiceSite != null)
                {
                    sitesCollection.Remove(fileServiceSite);
                }

                ConfigurationElementCollection bindingsCollection = fileServiceSite.GetCollection("bindings");

                ConfigurationElement bindingElement = bindingsCollection.CreateElement("binding");
                bindingElement["protocol"] = @"ftp";
                string bindingInformation = bindingElement["bindingInformation"] as string;

                if (!string.IsNullOrEmpty(bindingInformation))
                {
                    string[] bindingParts = bindingInformation.Split(':');
                    if (bindingParts.Length > 2)
                    {
                        int port = 0;
                        if (int.TryParse(bindingParts[1], out port))
                        {
                            Uhuru.Utilities.FirewallTools.ClosePort(port);
                        }
                    }
                }

                serverManager.CommitChanges();
            }
        }
Пример #29
0
        public void Remove()
        {
            var dialog = (IManagementUIService)GetService(typeof(IManagementUIService));

            if (
                dialog.ShowMessage("Are you sure that you want to remove the selected entry?", "Confirm Remove",
                                   MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) !=
                DialogResult.Yes)
            {
                return;
            }

            Items.Remove(SelectedItem);
            var service = (IConfigurationService)GetService(typeof(IConfigurationService));
            var section = service.GetSection("system.webServer/rewrite/outboundRules");
            ConfigurationElementCollection collection = section.GetCollection("customTags");

            collection.Remove(SelectedItem.Element);
            service.ServerManager.CommitChanges();

            SelectedItem = null;
            OnRewriteSettingsSaved();
        }
Пример #30
0
        public void RemoveRule()
        {
            var dialog = (IManagementUIService)this.GetService(typeof(IManagementUIService));

            if (
                dialog.ShowMessage("Are you sure that you want to remove the selected entry?", "Confirm Remove",
                                   MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) !=
                DialogResult.Yes)
            {
                return;
            }

            this.SelectedItem.Items.Remove(this.SelectedItem.SelectedItem);
            var service = (IConfigurationService)this.GetService(typeof(IConfigurationService));
            ConfigurationElementCollection collection = this.SelectedItem.Element.GetCollection();

            collection.Remove(this.SelectedItem.SelectedItem.Element);
            service.ServerManager.CommitChanges();

            this.SelectedItem.SelectedItem = null;
            this.OnRewriteSettingsSaved();
            this.SelectedItem.OnRewriteSettingsSaved();
        }