Beispiel #1
0
        //获取虚拟目录集合
        private VirtualDirectories GetVirDirs(DirectoryEntries des)
        {
            VirtualDirectories tmpdirs = new VirtualDirectories();

            foreach (DirectoryEntry de in des)
            {
                if (de.SchemaClassName == "IIsWebVirtualDir")
                {
                    VirtualDirectory vd = new VirtualDirectory();
                    vd.Name              = de.Name;
                    vd.AccessRead        = (bool)de.Properties["AccessRead"][0];
                    vd.AccessExecute     = (bool)de.Properties["AccessExecute"][0];
                    vd.AccessWrite       = (bool)de.Properties["AccessWrite"][0];
                    vd.AnonymousUserName = (string)de.Properties["AnonymousUserName"][0];
                    vd.AnonymousUserPass = (string)de.Properties["AnonymousUserName"][0];
                    vd.AuthBasic         = (bool)de.Properties["AuthBasic"][0];
                    vd.AuthNTLM          = (bool)de.Properties["AuthNTLM"][0];
                    vd.ContentIndexed    = (bool)de.Properties["ContentIndexed"][0];
                    vd.EnableDefaultDoc  = (bool)de.Properties["EnableDefaultDoc"][0];
                    vd.EnableDirBrowsing = (bool)de.Properties["EnableDirBrowsing"][0];
                    vd.AccessSSL         = (bool)de.Properties["AccessSSL"][0];
                    vd.AccessScript      = (bool)de.Properties["AccessScript"][0];
                    vd.Path              = (string)de.Properties["Path"][0];
                    vd.flag              = 0;
                    vd.DefaultDoc        = (string)de.Properties["DefaultDoc"][0];
                    tmpdirs.Add(vd.Name, vd);
                }
            }
            return(tmpdirs);
        }
Beispiel #2
0
        ///<summary>
        ///私有方法
        ///</summary>

        //连接服务器
        private void ConnectToServer()
        {
            string strPath = "IIS://" + _server + "/W3SVC/" + _website + "/ROOT";

            try
            {
                this.rootfolder = new DirectoryEntry(strPath);
                _virdirs        = GetVirDirs(this.rootfolder.Children);
            }
            catch (Exception e)
            {
                throw new Exception("Can't connect to the server [" + _server + "] ...", e);
            }
        }
Beispiel #3
0
 //重载一个:-)
 public void UpdateBatch(VirtualDirectories vds)
 {
     //BatchUpdate(vds);
 }