2010-09-07 82 views
1

由於某些原因,我無法使用LDS爲在LDS中創建的用戶身份驗證用戶憑據。AD輕型目錄服務未對用戶進行身份驗證

我的測試代碼:

 PrincipalContext context = new PrincipalContext(ContextType.ApplicationDirectory, "adlds:50000", "CN=test,DC=test,DC=internal", ContextOptions.Negotiate); 

     UserPrincipal user = new UserPrincipal(context); 

     user.Enabled = true; 
     user.Name = "MyTestUser"; 
     user.SetPassword("[email protected]"); 
     user.GivenName = "ATestUser123"; 
     user.Surname = "SurnameOf"; 

     user.Save(); 

     bool auth = context.ValidateCredentials("MyTestUser", "[email protected]"); 

ValidateCredentials每次返回false。

LDS正在加入域的Server 2008 R2上運行。我試圖重新創建上下文,過期密碼,通過ADSI手動重置密碼等。

有什麼想法?

回答

4

我出現了同樣的問題。我所做的和適用於我的是,在致電ValidateCredentials時,我修改了用戶名:

bool auth = context.ValidateCredentials(
          String.Format("CN={0},CN=test,DC=test,DC=internal", 
              "MyTestUser"), 
          "[email protected]"); 

希望這有助於您。

相關問題