c# b/s 如何建立虚拟目录

来源:百度知道 编辑:UC知道 时间:2024/05/27 17:29:12

const String constIISWebSiteRoot = "IIS://localhost/W3SVC/1/ROOT";
string virtualDirName = "virtualName";//虚拟目录名称
string physicalPath = @"c: ";
DirectoryEntry root = new DirectoryEntry(constIISWebSiteRoot);

DirectoryEntry tbEntry = root.Children.Add(virtualDirName, root.SchemaClassName);

tbEntry.Properties["Path"][0] = physicalPath;
tbEntry.Invoke("AppCreate", true);

tbEntry.Properties["AccessRead"][0] = false;
tbEntry.Properties["ContentIndexed"][0] = true; ;
tbEntry.Properties["DefaultDoc"][0] = "index.ASP,Default.ASPx";
tbEntry.Properties["AppFriendlyName"][0] = virtualDirName;
tbEntry.Properties["AccessScript"][0] =