小编LDA*_*mer的帖子

有没有办法为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;
            }
        }
    }
Run Code Online (Sandbox Code Playgroud)

我的adPath可以是2个值中的一个.其中一个值是最近加入的域,可以使用不同的工具进行访问.我相信这是.NET库如何进行LDAP调用的问题.

c# windows ldap active-directory windows-server

6
推荐指数
1
解决办法
3451
查看次数

标签 统计

active-directory ×1

c# ×1

ldap ×1

windows ×1

windows-server ×1