在C#中如何实现使文件夹成为共享或Web共享

Web共享

DirectoryEntry ent = new DirectoryEntry("IIS://oh35d-install1/w3svc");
DirectoryEntry entchild = new DirectoryEntry();
entchild = ent.Children.Add("5","IIsWebServer");
entchild.CommitChanges();
entchild.Properties["ServerBindings"].Value = ":123:";
entchild.Properties["ServerState"].Value = 2;
entchild.Properties["ServerComment"].Value = "TESTSITE";
entchild.CommitChanges();
DirectoryEntry vdir = entchild.Children.Add("ROOT","IIsWebVirtualDir");
vdir.CommitChanges();
vdir.Properties["AppIsolated"].Value = 2;
vdir.Properties["Path"].Value = @"C:\Inetpub\wwwroot";
vdir.Properties["AuthFlags"].Value = 5;
vdir.Properties["DirBrowseFlags"].Value = 1073741886;
vdir.Properties["AccessFlags"].Value = 513;
vdir.CommitChanges();
entchild.CommitChanges();
ent.CommitChanges();

Published At
Categories with Web编程
Tagged with
comments powered by Disqus