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;
}
查看全文
相关阅读:
JAVA中的super和this关键字的使用
JAVA中类以及成员变量和成员方法的修饰符的总结
JAVA中的抽象类和接口
JAVA对数据库进行操作,实现数据库中数据的插入,查询,更改,删除操作
完整日期正则表达式
2017实习【Java研发】面经
MySQL事务及隔离级别(读书小结)
Java类编译、加载、和执行机制
JVM内存回收机制
Centos6.5的MySQL5.7.15二进制源码单机版安装
原文地址:https://www.cnblogs.com/hanguoji/p/517403.html
最新文章
【Java杂货铺】JVM#Java高墙之内存模型
Mongo学习记录
强大的CompletableFuture
好久不见,Java设计模式
【SpringCloud】Eureka入门与原理
less
Groovy语言学习--语法基础(5)
Groovy语言学习--语法基础(4)
Groovy语言学习--语法基础(3)
Kibana:分析及可视化日志文件
热门文章
Groovy语言学习--语法基础(2)
Groovy语言学习--语法基础(1)
Linux常用命令行
elaticsear no [query] registered for [filtered] 错误
案例学Python--案例四:Django实现一个网站的雏形(2)
对Spark2.2.0文档的学习3-Spark Programming Guide
对Spark2.2.0文档的学习2-Job Scheduling
对Spark2.2.0文档的学习1-Cluster Mode Overview
Comparable接口和Comparator接口
JAVA中的I/O流以及文件操作
Copyright © 2011-2022 走看看