public void Execute() { this.checkPoints.Clear(); this.SaveLocalPath(); this.SaveAppPoolName(); try { IisUtility.FindWebDirObject(this.Parent, this.Name); IisUtility.DeleteWebDirObject(this.Parent, this.Name); this.checkPoints.Push(DeleteVirtualDirectory.CheckPoint.VirtualDirectoryDeleted); } catch (WebObjectNotFoundException) { } string hostName = IisUtility.GetHostName(this.parent); if (this.applicationPool != null && IisUtility.IsSupportedIisVersion(hostName)) { if (!this.DeleteApplicationPool) { if (!IisUtility.ApplicationPoolIsEmpty(this.applicationPool, hostName)) { return; } } try { string appPoolRootPath = IisUtility.GetAppPoolRootPath(hostName); IisUtility.FindWebObject(appPoolRootPath, this.applicationPool, "IIsApplicationPool"); IisUtility.DeleteApplicationPool(hostName, this.applicationPool); this.checkPoints.Push(DeleteVirtualDirectory.CheckPoint.ApplicationPoolDeleted); } catch (WebObjectNotFoundException) { } } }