2013-01-10 67 views
0

我使用的代碼塊下面讓LDAP用戶名(我只給第一線)獲取LDAP用戶名無效過濾

using (PrincipalContext context = new PrincipalContext(ContextType.Domain)) 
{ 

} 

一次我發佈asp.net MVC應用服務器它給了我一個錯誤。

ArgumentException的:將(&(objectCategory =用戶)(objectClass的=用戶)(|(的UserPrincipalName =)(的distinguishedName =)(名稱=)))搜索過濾器無效]

回答

1

嘗試像這樣傳遞域參數。

using(PrincipalContext pc = new PrincipalContext(ContextType.Domain, domain)) { 
     // validate the credentials 
     result = pc.ValidateCredentials(username, password); 
}