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;
}
查看全文
相关阅读:
程序基址,X64Dbg软件常用调试技巧查找系统函数调用位置执行到指定位置断点
#pragma的常用方法讲解,为什么有了条件编译符号“DEBUG”还要来个Debugger.IsAttached
JDK17Src0.java.base
nmon的安装和使用
64位下的相对指令地址X86指令格式(操作码列和指令列解释)
内存中的程序剖析
Linux I/O 原理和 Zerocopy 技术全面揭秘
Ubuntu命令行的垃圾箱,回收站
SecureCRT密钥链接阿里云
HTTP API 认证授权术
原文地址:https://www.cnblogs.com/hanguoji/p/517403.html
最新文章
OpenShift 本地开发环境配置(基于 Minishift)
CentOS7 使用firewallcmd添加、删除、查看防火墙规则
CAS学习笔记二:CAS单点登录流程
OpenShift S2I 概念及流程
转载 Secure, HttpOnly, SameSite HTTP Cookies Attributes and SetCookie Explained
Oracle VirtualBox 配置宿主机与虚拟机互访
Vue 前端配置多级目录实践(基于Nginx配置方式)
附使用及记忆方法,Win11 常用快捷键一览
IDEA DEEP design 设计哲学
6个关于dd命令备份Linux系统的例子
热门文章
echo和Shell特殊变量:Shell $0, $#, $*, $@, $?, $$和命令行参数
Java线程和操作系统线程的关系,Java线程和操作系统线程的关系——从源码尝试解答
c++字符前面的L和_T
Linux 内核终于可以 debug 了!
JDK 1.8 下的 java.lang.Class 对象和 static 成员变量在堆还是方法区?
新时代的「卢德分子」:互联网行业会被培训机构毁掉吗?
Redis 之布隆过滤器,增强版,布谷鸟过滤器
JMM概述,【Java线程】Java内存模型总结
MESI 缓存一致性协议
这到底是谁之错?
Copyright © 2011-2022 走看看