iis的完整控制类(编辑修改稿)内容摘要:

{ //throw new Exception(This virtual directory is not exists)。 } return tmp。 } /// summary /// 更新一个虚拟目录 /// /summary /// param name=dir/param public void Update(VirtualDirectory dir) { //判断需要更改的虚拟目录是否存在 if (()) { DirectoryEntry ode = (, IIsWebVirtualDir)。 UpdateDirInfo(ode, dir)。 } else { //throw new Exception(This virtual directory is not exists.)。 } } /// summary /// 删除一个虚拟目录 /// /summary /// param name=strVirdir/param public void Delete(string strVirdir) { if ((strVirdir)) { object[] paras = new object[2]。 paras[0] = IIsWebVirtualDir。 //表示操作的是虚拟目录 paras[1] = strVirdir。 (Delete, paras)。 ()。 } else { //throw new Exception(Can39。 39。 t delete + strVirdir + ,because it isn39。 39。 t exists.)。 } } /// summary /// 批量更新 /// /summary public void UpdateBatch() { BatchUpdate(_virdirs)。 } //重载一个: ) public void UpdateBatch(VirtualDirectories vds) { BatchUpdate(vds)。 } ///summary ///私有方法 ////summary public void Close() { ()。 _virdirs = null。 ()。 } /// summary /// 连接服务器 /// /summary private void ConnectToServer() { string strPath = + _server + /W3SVC/ + _website + /ROOT。 try { = new DirectoryEntry(strPath)。 _virdirs = GetVirDirs()。 } catch (Exception e) { //throw new Exception(Can39。 39。 t connect to the server [+ _server +] ...,e)。 } } //执行批量更新 private void BatchUpdate(VirtualDirectories vds) { _batchflag = true。 foreach (object item in ) { VirtualDirectory vd = (VirtualDirectory) item。 switch () { case 0: break。 case 1: Create(vd)。 break。 case 2: Update(vd)。 break。 } } _batchflag = false。 } //更新东东 private void UpdateDirInfo(DirectoryEntry de, VirtualDirectory vd) { [AnonymousUserName][0] =。 [AnonymousUserPass][0] =。 [AccessRead][0] =。 [AccessExecute][0] =。 [AccessWrite][0] =。 [AuthBasic][0] =。 [AuthNTLM][0] =。 [ContentIndexed][0] =。 [EnableDefaultDoc][0] =。 [EnableDirBrowsing][0] =。 [AccessSSL][0] =。 [AccessScript][0] =。 [DefaultDoc][0] =。 [Path][0] =。 [AppFriendlyName][0] =。 ()。 } //获取虚拟目录集合 private VirtualDirectories GetVirDirs(DirectoryEntries des) { VirtualDirectori。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。