IIS6.0下指定目录下创建虚拟目录

DirectoryEntry iisrootdirectory = new DirectoryEntry("IIS://localhost/W3SVC/1/Root");

 iisrootdirectory.RefreshCache();

 foreach (DirectoryEntry child in iisrootdirectory.Children)  //循环遍历根目录下的images
 {
     if (child.Name.Contains("images"))
     {
         DirectoryEntry virtualdirectory = child.Children.Add("upload", "IIsWebVirtualDir");

         virtualdirectory.Properties["Path"].Insert(0, @"C:\TestWebSite\upload");

         virtualdirectory.Invoke("AppCreate", true);

         virtualdirectory.CommitChanges();

         iisrootdirectory.CommitChanges();

         virtualdirectory.Close();

         iisrootdirectory.Close();

     }
 }


个人站点:http://kiccleaf.com

阅读更多
文章标签: iis upload path c
个人分类: IIS技术
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭