CSDN博客

img yuxuehui

C#在iis里添加虚拟目录

发表于2008/9/29 0:36:00  233人阅读

 要引用using System.DirectoryServices;

 

 

DirectoryEntry deyTemp= new DirectoryEntry("IIS://localhost/w3svc/1/Root");

DirectoryEntry deyNew;
            deyNew = deyTemp.Children.Add(strName, "IIsWebVirtualDir");//填加虚拟目录
            deyNew.CommitChanges();
            deyNew.Properties["Path"][0] = (strPath);//设定虚拟路径
            deyNew.Properties["AccessScript"][0] = true;
            deyNew.CommitChanges();
            //配置虚拟目录
            deyNew.Properties["AccessRead"][0] = true;//可读
            deyNew.Properties["ContentIndexed"][0] = true;
            deyNew.Properties["AppFriendlyName"][0] = strName;
            deyNew.Properties["DefaultDoc"][0] = "Index.aspx,Default.aspx";
            deyNew.Properties["AccessScript"][0] = true;
            deyNew.Properties["DontLog"][0] = true;
            deyNew.Properties["AuthFlags"][0] = 1;
            deyNew.Properties["AppIsolated"][0] = 2;
            deyNew.Invoke("AppCreate", true);
            deyNew.CommitChanges();

阅读全文
0 0

相关文章推荐

img
取 消
img