代码如下:
String constIISWebSiteRoot = "IIS://"+serverName+"/W3SVC/"+serverID+"/ROOT";
DirectoryEntry root = new DirectoryEntry(constIISWebSiteRoot);
DirectoryEntry newVirDir = root.Children.Add(virtualDirName, "IIsWebVirtualDir");
newVirDir.Invoke("AppCreate", true); newVirDir.Properties["Path"][0] = virtualDirDefaultFolder;
newVirDir.Properties["AccessRead"][0] = true;
newVirDir.Properties["AccessScript"][0] = true;
newVirDir.Properties["DefaultDoc"][0] = defaultDoc;
newVirDir.Properties["AppIsolated"][0] = 2;
newVirDir.Properties["DontLog"][0] = true;
newVirDir.Properties["ContentIndexed"][0] = true;
newVirDir.Properties["AuthFlags"][0] = 1; newVirDir.CommitChanges();
root.CommitChanges(); newVirDir.Close();
newVirDir.Dispose();
root.Close();
root.Dispose();我在网站后台增加创建虚拟目录功能,问题是:
该服务器下有多个站点,我如何获取所用站点的serverID,我知道默认站点的是1 ,但当前站点的是多少呢?怎样才能把虚拟目录创建到当前站点下呢?紧急求救
String constIISWebSiteRoot = "IIS://"+serverName+"/W3SVC/"+serverID+"/ROOT";
DirectoryEntry root = new DirectoryEntry(constIISWebSiteRoot);
DirectoryEntry newVirDir = root.Children.Add(virtualDirName, "IIsWebVirtualDir");
newVirDir.Invoke("AppCreate", true); newVirDir.Properties["Path"][0] = virtualDirDefaultFolder;
newVirDir.Properties["AccessRead"][0] = true;
newVirDir.Properties["AccessScript"][0] = true;
newVirDir.Properties["DefaultDoc"][0] = defaultDoc;
newVirDir.Properties["AppIsolated"][0] = 2;
newVirDir.Properties["DontLog"][0] = true;
newVirDir.Properties["ContentIndexed"][0] = true;
newVirDir.Properties["AuthFlags"][0] = 1; newVirDir.CommitChanges();
root.CommitChanges(); newVirDir.Close();
newVirDir.Dispose();
root.Close();
root.Dispose();我在网站后台增加创建虚拟目录功能,问题是:
该服务器下有多个站点,我如何获取所用站点的serverID,我知道默认站点的是1 ,但当前站点的是多少呢?怎样才能把虚拟目录创建到当前站点下呢?紧急求救
解决方案 »
- 询问邮箱加约束的代码
- WINDOWS SERVER 2003 SP2 导致ASP.NET 1.1下的FORM不能提交
- 急急急急急!链接Oracle数据库错误:发生了一个 Oracle 错误,但无法从 Oracle 中检索错误信息 分不够可以增加
- 求椅正则表达式
- 请教类似当当网的滚动广告条的制作方法。。http://www.dangdang.com/class/book/01.03/01.03.00.00.00.00.shtml
- 哪位好心人能告诉我怎么在页面中加视频文件吗?
- 动态加入buttoncolomn,但是function没运行,大家帮看看错那里了?
- !!!!!!!!!!!!!!!!DataGrid中Checkbox事件怎么触发?
- 我以前的程序用vs2002开发的,现在想升级成2003的web服务器该怎么做?!
- 如何从数据库查询返回NULL!
- 左边的C#页面怎么循环调用右边的ASP页面?
- 怎样截取这段字符串?
DirectoryEntry root = new DirectoryEntry(strWeb);
foreach(DirectoryEntry oEntry in root.Children)
{
if(oEntry.SchemaClassName == strSchema)
{
//得到站点显示的名字
//this.comboBox1.Items.Add(oEntry.Name + "," + oEntry.Properties["ServerComment"][0] + "-" + oEntry.Properties["ServerBindings"][0]);
this.comboBox1.Items.Add(oEntry.Properties["ServerComment"][0]);
this.comboBox1.SelectedIndex = 0;
}
}
string strSchema = "IIsWebServer";DirectoryEntry root = new DirectoryEntry(strWeb);
foreach(DirectoryEntry oEntry in root.Children)
{
if(oEntry.SchemaClassName == strSchema)
{
//得到站点显示的名字
//this.comboBox1.Items.Add(oEntry.Name + "," + oEntry.Properties["ServerComment"][0] + "-" + oEntry.Properties["ServerBindings"][0]);
Response.Write(oEntry.Properties["ServerComment"][0]);
}
}