有没有办法为UserPrincipal.FindByIdentity()启用引荐追逐?
我有一个使用System.DirectoryServices.AccountManagement类的.NET 3.5 Web应用程序。当我搜索一些用户时,我得到一个PrincipalOperationException:从服务器返回一个引用。如果我使用自己的LDAP代码执行旧学校的方式,我可以启用追踪推荐。我需要重写我的代码吗?
我的代码看起来像这样:
using (var principalContext = new PrincipalContext(ContextType.Domain, null, adPath))
{
// Find the principal object for which you wish to enumerate group
// membership.
using (var userPrincipal = UserPrincipal.FindByIdentity(principalContext, identity))
{
if (userPrincipal != null)
{
Name = userPrincipal.DisplayName;
DistinguishedName = userPrincipal.DistinguishedName;
EmailAddress = userPrincipal.EmailAddress;
Sid = userPrincipal.Sid.Value;
}
}
}
我的adPath可以是2个值中的一个。其中一个值是最近加入的域,可以使用不同的工具进行访问。我相信这是.NET库如何进行LDAP调用的问题。
没有找到相关结果
已邀请:
2 个回复
驮帽俺篮号
它应该包含所有林域的数据。 我希望它有所帮助。
梦砍废么
还要确保
从最具体到最不具体。