Beispiel #1
0
        public WebSiteInfo GetWebsiteInfo(string webSiteID)
        {
            WebSiteInfo    siteInfo  = new WebSiteInfo();
            DirectoryEntry rootEntry = GetDirectoryEntry("");

            foreach (DirectoryEntry ent in rootEntry.Children)
            {
                if (ent.Name == webSiteID && ent.SchemaClassName == "IIsWebServer")
                {
                    siteInfo.SiteName = ent.Properties[WebSiteParameter.ServerComment.ToString()].Value.ToString();
                    siteInfo.Bindings = ent.Properties[WebSiteParameter.ServerBindings.ToString()].Value;
                    siteInfo.State    = (WebSiteState)ent.Properties["ServerState"].Value;
                    siteInfo.LogFileLocaltimeRollover = SmString.StringToBool(ent.Properties[WebSiteParameter.LogFileLocaltimeRollover.ToString()].Value.ToString());
                    siteInfo.LogFileDirectory         = ent.Properties[WebSiteParameter.LogFileDirectory.ToString()].Value.ToString();

                    DirectoryEntry appInfo = ent.Children.Find("root", "IIsWebVirtualDir");
                    siteInfo.AccessUser    = new IdentityAuthInfo(appInfo.Properties[WebVirtualDirParameter.AnonymousUserName.ToString()].Value.ToString(), appInfo.Properties[WebVirtualDirParameter.AnonymousUserPass.ToString()].Value.ToString());
                    siteInfo.AppPoolName   = appInfo.Properties[WebVirtualDirParameter.AppPoolId.ToString()].Value.ToString();
                    siteInfo.DirectoryPath = appInfo.Properties[WebVirtualDirParameter.Path.ToString()].Value.ToString();
                    siteInfo.ScriptMaps    = appInfo.Properties[WebVirtualDirParameter.ScriptMaps.ToString()].Value;

                    return(siteInfo);
                }
            }
            DisposeDirectoryEntry(rootEntry);
            return(siteInfo);
        }
        public WebSiteInfo GetWebsiteInfo(string webSiteID)
        {
            WebSiteInfo siteInfo = new WebSiteInfo();
            DirectoryEntry rootEntry = GetDirectoryEntry("");
            foreach (DirectoryEntry ent in rootEntry.Children)
            {
                if (ent.Name == webSiteID && ent.SchemaClassName == "IIsWebServer")
                {
                    siteInfo.SiteName = ent.Properties[WebSiteParameter.ServerComment.ToString()].Value.ToString();
                    siteInfo.Bindings = ent.Properties[WebSiteParameter.ServerBindings.ToString()].Value;
                    siteInfo.State = (WebSiteState)ent.Properties["ServerState"].Value;
                    siteInfo.LogFileLocaltimeRollover = SmString.StringToBool(ent.Properties[WebSiteParameter.LogFileLocaltimeRollover.ToString()].Value.ToString());
                    siteInfo.LogFileDirectory = ent.Properties[WebSiteParameter.LogFileDirectory.ToString()].Value.ToString();

                    DirectoryEntry appInfo = ent.Children.Find("root", "IIsWebVirtualDir");
                    siteInfo.AccessUser = new IdentityAuthInfo(appInfo.Properties[WebVirtualDirParameter.AnonymousUserName.ToString()].Value.ToString(), appInfo.Properties[WebVirtualDirParameter.AnonymousUserPass.ToString()].Value.ToString());
                    siteInfo.AppPoolName = appInfo.Properties[WebVirtualDirParameter.AppPoolId.ToString()].Value.ToString();
                    siteInfo.DirectoryPath = appInfo.Properties[WebVirtualDirParameter.Path.ToString()].Value.ToString();
                    siteInfo.ScriptMaps = appInfo.Properties[WebVirtualDirParameter.ScriptMaps.ToString()].Value;

                    return siteInfo;
                }
            }
            DisposeDirectoryEntry(rootEntry);
            return siteInfo;
        }