1.基础知识.
上面是建立站点的代码,这里是查找一个站点的方法
public bool ExistsSite( string siteName )
{
if ( directoryEntry == null || siteName == String.Empty )
{
return false ;
}
bool bExists = false;
try
{
foreach (
DirectoryEntry child in directoryEntry.Children )
{
if( child.SchemaClassName == "IIsWebServer " )
{
if( child.Properties[ "ServerComment "].Value != null )
{
if ( child.Properties[ "ServerComment "].Value.ToString() == siteName )
{
bExists = true;
break;
}
}
}
}
}
catch
{
throw;
}
return bExists;
}
我遇到了另外一个关于ADSI的问题
在本地所有工作都能完成,但传到服务器上以后就出错误,提示拒绝访问
directoryEntry
找了一些资料说没有权限,我把ASPNET加到ADMINISTRATORS组里也不行,请问如何解决?
解决这问题可以这样做:
在 <authentication mode= "Windows " /> 节点下添加以下内容
<identity impersonate= "true " userName= "administrator " password= "sanlng "/>
"administrator "与 "sanlng "分别是管理员帐户与密码.
下一篇: