【发布时间】:2009-01-22 10:49:17
【问题描述】:
我在 IIS 7.0 中遇到了一个奇怪的问题:
并且在 IIS 中的虚拟目录上只启用了 Windows 身份验证模式
现在,如果我尝试以这种方式为 TestV/Folder/file.aspx 获取关联的 DirectoryEntry:
string vDir = @"/TestV/folder/file.aspx";
DirectoryEntry dir = new DirectoryEntry("IIS://" + serverName + "/W3SVC/1/ROOT" + vDir, @"adminusername", @"password");
dir.AuthenticationType = AuthenticationTypes.Secure;
try
{
Console.WriteLine(dir.Name);
}
catch (Exception exp)
{
Console.WriteLine(exp.Message);
}
Console.WriteLine("");
我得到了例外: "系统找不到指定的路径"
现在,如果我返回 IIS,然后执行以下步骤: 右键单击TestV/Folder启用匿名身份验证模式,然后再次禁用它
右击TestV/Folder/file.aspx启用匿名认证模式,然后再次禁用
基本上我只是对 aspx 文件 Testv/Folder/file.aspx 执行了一些手动访问。
经过上述步骤,如果我重新运行程序,代码就可以成功访问目录条目并成功打印名称(file.aspx)
这里有什么问题?
更多信息:
我在 IIS 6.0 上也看到了这种行为。因此,除非我在 IIS 中对虚拟目录中的文件夹/文件进行一些手动操作,否则它似乎不会在活动目录中创建相应的元数据?
【问题讨论】:
标签: c# iis-7 active-directory