在.NET4.5下测试我们的.NET4.0应用程序时,我们遇到了UserPrincipal的FindByIdentity方法的问题。以下代码在.NET4.0运行时中运行时有效,但在.NET4.5下失败:[Test]publicvoidTestIsAccountLockedOut(){conststringactiveDirectoryServer="MyActiveDirectoryServer";conststringactiveDirectoryLogin="MyADAccount@MyDomain";conststringactiveDirectoryPassword="MyAD
我正在尝试使用.Net中的目录服务运行简单的LDAP查询。DirectoryEntrydirectoryEntry=newDirectoryEntry("LDAP://someserver.contoso.com/DC=contoso,DC=com");directoryEntry.AuthenticationType=AuthenticationTypes.Secure;DirectorySearcherdirectorySearcher=newDirectorySearcher(directoryEntry);directorySearcher.Filter=string.Form
UserPrincipalSamAccountNamethrowsDirectoryServicesCOMExceptionunhandled"Alocalerrorhasoccured"我正在编写一段代码,它应该根据他们的SamAccountName作为搜索参数在活动目录中搜索特定用户GivenName(forename)和Surname,然后返回一个包含他们的名字和姓氏的字符串.目前我写的代码如下:123456789101112131415161718192021publicstaticstringGetName(stringuName) { StringBuilderbuilde
UserPrincipalSamAccountNamethrowsDirectoryServicesCOMExceptionunhandled"Alocalerrorhasoccured"我正在编写一段代码,它应该根据他们的SamAccountName作为搜索参数在活动目录中搜索特定用户GivenName(forename)和Surname,然后返回一个包含他们的名字和姓氏的字符串.目前我写的代码如下:123456789101112131415161718192021publicstaticstringGetName(stringuName) { StringBuilderbuilde