public static IISSite FindSite(IISIdentifier Identifier) { IISServerManagerSite retVal = new IISServerManagerSite(); retVal.site = retVal.ServerMgr.Sites[Identifier.Value]; //Return null if the site was not found return (retVal.site != null) ? retVal : null; }
public static IISServerManagerSite CreateNewSite(String serverComment, String serverBindings, String filePath) { Directory.CreateDirectory(filePath); IISServerManagerSite retVal = new IISServerManagerSite(); retVal.site = retVal.ServerMgr.Sites.Add(serverComment, filePath, 80); retVal.SetBindings(serverBindings); //We also need to setup an app pool most likely ApplicationPool appPool = retVal.ServerMgr.ApplicationPools[serverComment]; appPool = appPool ?? retVal.ServerMgr.ApplicationPools.Add(serverComment); retVal.site.ApplicationDefaults.ApplicationPoolName = serverComment; return retVal; }