zoukankan
html css js c++ java
对IIS、虚拟目录等进行管理
引用命名空间:
using System.DirectoryServices;
要实例的对象:
private Aspcn.Management.IISManager IISMan;
获取虚拟目录的物理路径
//
获取虚拟路径的相关信息
private
void
btnGet_Click(
object
sender, System.EventArgs e)
{
tbServer.Text
=
"
localhost
"
;
tbWebSite.Text
=
"
www.163.com
"
;
tbVirDirName.Text
=
"
DirectoryName
"
;
string
strVirdir
=
this
.tbVirDirName.Text;
string
strServer
=
this
.tbServer.Text;
string
strWebSite
=
this
.tbWebSite.Text;
string
strMsg
=
""
;
try
{
IISMan.Connect(strServer,strWebSite);
VirtualDirectory vd
=
IISMan.GetVirDir(strVirdir);
this
.tbVirDirName.Text
=
vd.Name;
this
.tbPath.Text
=
vd.Path;
this
.CBExecute.Checked
=
vd.AccessExecute;
this
.CBRead.Checked
=
vd.AccessExecute;
this
.CBScript.Checked
=
vd.AccessScript;
this
.CBSSL.Checked
=
vd.AccessSSL;
this
.CBWrite.Checked
=
vd.AccessWrite;
this
.CBBasicAuth.Checked
=
vd.AuthBasic;
this
.CBNtlmAuth.Checked
=
vd.AuthNTLM;
this
.CBEnableIndexed.Checked
=
vd.ContentIndexed;
this
.CBEnableDefaultDoc.Checked
=
vd.EnableDefaultDoc;
this
.CBEnableBrowing.Checked
=
vd.EnableDirBrowsing;
this
.tbPath.Text
=
vd.Path;
string
[] defaultdoc
=
vd.DefaultDoc.Split(
"
,
"
.ToCharArray());
foreach
(
string
item
in
defaultdoc)
{
if
(item
!=
""
)
{
this
.lstDefaultDoc.Items.Add(item);
}
}
strMsg
=
"
获取
"
+
strVirdir
+
"
成功
"
;
}
catch
(Exception ee)
{
strMsg
=
"
获取虚拟目录失败!错误如下:\n
"
+
ee.ToString();
}
finally
{
MessageBox.Show(strMsg,
"
查看信息
"
,MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
//
得到一个虚拟目录
public
VirtualDirectory GetVirDir(
string
strVirdir)
{
VirtualDirectory tmp
=
null
;
if
(_virdirs.Contains(strVirdir))
{
tmp
=
_virdirs.Find(strVirdir);
((VirtualDirectory)_virdirs[strVirdir]).flag
=
2
;
}
else
{
throw
new
Exception(
"
This virtual directory is not exists
"
);
}
return
tmp;
}
查看全文
相关阅读:
二叉排序树和平衡二叉树
博客首页特效整理2
博客首页特效整理
19-20下学期思维导图
19-20下学期第一次作业问卷调查回答
c++实现五子棋游戏
c++实现扫雷游戏
c++实现2048游戏
c++实现推箱子游戏
C++实现贪吃蛇小游戏
原文地址:https://www.cnblogs.com/hanguoji/p/517403.html
最新文章
java反射1
Java核心类2
Java核心类
函数闭包
豆瓣爬虫实战
学习笔记6
学习笔记5
学习笔记4
学习笔记3
学习笔记2
热门文章
学习计划思维导图
学习进度表
学习笔记1
问卷调查
创新创业感想
数据结构与算法-哈夫曼树
图
排序
栈与队列的区别
循环、递归、遍历、迭代的区别
Copyright © 2011-2022 走看看