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;
}
查看全文
相关阅读:
Linux安装.net core
在IIS中如何配置SSL(https)
Lambda的前世今生
Java建造者模式
leetcode 83 Remove Duplicates from Sorted List
【设计】Office
【设计】简书品牌重构
【设计总结】
【交互设计】
【设计总结】
原文地址:https://www.cnblogs.com/hanguoji/p/517403.html
最新文章
js 数组API之forEach、map的用法
js 对象的值传递
js 错误Error对象详解
js 闭包的用法详解
angular4.0 路由守卫详解
npm安装删除模块以及cnpm淘宝镜像
angular4.0 安装最新版本的nodejs、npm、@angular/cli的方法
js的onscroll、scrollTop、scrollHeight及window.scroll等方法
vue2.0 通过v-html指令渲染的富文本无法修改样式的解决方案
vue2.0 页面A跳转到页面B,B页面停留在A页面的滚动位置的解决方法
热门文章
vue2.0 资源文件assets和static的区别
vue2.0 配置build项目打包目录、资源文件(assetsstatic)打包目录
vue2.0 路由模式mode="history"的作用
exports与module.exports,export与export default 之间的关系和区别
PowerDesigner设置Oracle不区分大小写
一步一步搭建vue项目
mvc几种传值方式
C# WebClient实现文件上传
webapi研究说明
.net core创建控制台应用程序和mvc程序
Copyright © 2011-2022 走看看