惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
CERT Recently Published Vulnerability Notes
S
Security @ Cisco Blogs
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Help Net Security
Help Net Security
Spread Privacy
Spread Privacy
WordPress大学
WordPress大学
S
Schneier on Security
博客园 - 聂微东
C
Cybersecurity and Infrastructure Security Agency CISA
F
Full Disclosure
人人都是产品经理
人人都是产品经理
Cisco Talos Blog
Cisco Talos Blog
D
Docker
aimingoo的专栏
aimingoo的专栏
Application and Cybersecurity Blog
Application and Cybersecurity Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
月光博客
月光博客
GbyAI
GbyAI
Stack Overflow Blog
Stack Overflow Blog
V
Visual Studio Blog
Security Latest
Security Latest
C
CXSECURITY Database RSS Feed - CXSecurity.com
N
News and Events Feed by Topic
小众软件
小众软件
A
About on SuperTechFans
Scott Helme
Scott Helme
Cloudbric
Cloudbric
T
Threatpost
雷峰网
雷峰网
NISL@THU
NISL@THU
N
News | PayPal Newsroom
Microsoft Azure Blog
Microsoft Azure Blog
T
Tailwind CSS Blog
T
Tor Project blog
T
The Blog of Author Tim Ferriss
The Hacker News
The Hacker News
C
Cyber Attacks, Cyber Crime and Cyber Security
量子位
Latest news
Latest news
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
I
Intezer
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
P
Privacy International News Feed
TaoSecurity Blog
TaoSecurity Blog
N
News and Events Feed by Topic
IT之家
IT之家
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
MongoDB | Blog
MongoDB | Blog
P
Privacy & Cybersecurity Law Blog

博客园 - 范燕军

UML学习之用例图 jquery分页控件 对象,XML序列化 (转)C#中调用Windows API时的数据类型对应关系 asp.net页生命周期 SVN服务端的配置 [ 转] .NET相关的最好东西--全球最新评价 asp.net执行.sql文件 [转] 使用JavaScript检测浏览器的相关特性 [转] 路径,文件,目录,I/O常见操作汇总(三) [转] 路径,文件,目录,I/O常见操作汇总(二) [转] 路径,文件,目录,I/O常见操作汇总(一) [转]NET用户控件文件上传,并给图片文件加水印(增加文字水印文字设置) [转] Javascript访问Cookie的四个常用方法 [转] Javascript访问Cookie的四个常用方法 [转]C#实现MS SQL数据导出到Excel [转]常用的JavaScript验证正则表达式 [转]ajax加载内容示例 [转]14 个经典的javascript代码
[转] 用ASP.NET对IIS中的虚拟目录进行操作
范燕军 · 2008-04-02 · via 博客园 - 范燕军

在做系统开发的过程中,我们经常会遇到用asp.net来操作IIS,如新建虚拟目录、更改虚拟目录的属性、删除虚拟目录等操作,现在分析如下:
//假如虚拟目录名为"Webtest",先在项目中引用    
//System.DirectoryServices.dll,再  
using  System.DirectoryServices;  
protected  System.DirectoryServices.DirectoryEntry  dirroot;  
 
1、添加新的虚拟目录  
         DirectoryEntry  newVirDir  =  dirroot.Children.Add("Webtest","IIsWebVirtualDir");  
         newVirDir.Invoke("AppCreate",true);  
         newVirDir.CommitChanges();  
         dirroot.CommitChanges();  
2、更改虚拟目录属性  
       //虚拟目录的属性较常用的有:AccessRead,AccessWrite,AccessExecute,AccessScript,DefaultDoc,EnableDefaultDoc,Path等  
       
         DirectoryEntry  Dirport  =  dirroot.Children.Find("Webtest","IIsVirtualDir");  
         Dirport  .Properties["AccessRead"][0]  =  true;  
 
3、删除虚拟目录  
           DirectoryEntry  Dirport  =  dirroot.Children.Find("Webtest","IIsVirtualDir");  
           Dirport.Invoke("AppDelete",true);  
           dirroot.CommitChanges();  
或者:  
 
         object[]  part  =  new  object[2];  
         part[0]  =  "IIsWebVirtualDir";    
         part[1]  =  "Webtest";  
         dirroot.Invoke("Delete",part);  
         dirroot.CommitChanges();  

下面给出相关文章:

Managing virtual directories on multiple IIS sites and servers
http://www.codeproject.com/vb/net/VDirViewer.aspHow to create a virtual directory with C#
http://www.codeproject.com/csharp/virtualdir.asp