public void Delete(string id) { RuleId ruleId = new RuleId(id); Site site = ruleId.SiteId == null ? null : SiteHelper.GetSite(ruleId.SiteId.Value); if (ruleId.SiteId != null && site == null) { // The rule id specified a site but we couldn't find it, therefore we can't get the rule Context.Response.StatusCode = (int)HttpStatusCode.NoContent; return; } Rule rule = IPRestrictionsHelper.GetRules(site, ruleId.Path).Where(r => r.IpAddress.ToString().Equals(ruleId.IpAddress)).FirstOrDefault(); if (rule != null) { var section = IPRestrictionsHelper.GetSection(site, ruleId.Path, ManagementUnit.ResolveConfigScope()); IPRestrictionsHelper.DeleteRule(rule, section); ManagementUnit.Current.Commit(); } Context.Response.StatusCode = (int)HttpStatusCode.NoContent; }