public static bool DeleteSite(IISIdentifier siteIdentifier) { String id = ""; //need to be sure that the site exists or else it can throw an error if (IISWMIHelper.TryGetSiteID(siteIdentifier, ref id)) { DirectoryEntry webServer = IISWMIHelper.GetIIsWebServer(id); webServer.Invoke("Stop", null); webServer.DeleteTree(); return(true); } return(false); }
//Return null if the site is not to be found public static IISWMISite FindSite(IISIdentifier Identifier) { String id = ""; //need to be sure that the site exists or else it can throw an error if (IISWMIHelper.TryGetSiteID(Identifier, ref id)) { return(new IISWMISite() { SiteId = id }); } return(null); }