2012-04-29 124 views
0

我試圖檢測用戶是否必須在Active Directory中重置他的密碼。我正在使用用C#編寫的控制檯應用程序。檢測用戶是否必須重置密碼在Active Directory中

我有虛擬專用服務器上GoDaddy的我試圖運行

string strUserName = userName; 
user = new DirectoryEntry("LDAP://0.0.0.0", "GodadyLogiUserInfo", "GodadyLogiUserPass", AuthenticationTypes.Secure); 
DirectorySearcher searcher = new DirectorySearcher(user); 

searcher.Filter = "(SAMAccountName=" + <USERWHICHNEEDTOTEST>+ ")"; 
searcher.CacheResults = false; 

// Find user 
SearchResult result = searcher.FindOne(); 
user = result.GetDirectoryEntry(); 

它拋出錯誤

的服務器不可操作。

我在SOF和許多網站上嘗試了很多方法,但無法找到。

回答

0

只是嘗試連接AD這樣的:

/* Connexion to Active Directory 
*/ 
string sFromWhere = "LDAP://ServerDnsName:389/dc=dom,dc=.."; 
DirectoryEntry deBase = new DirectoryEntry(sFromWhere, "ADUser", "ADPwd"); 
1

LDAP://0.0.0.0是一個有效的地址,爲服務器在聽。它不是客戶端嘗試連接的有效地址。您必須提供適當的主機名或IP地址。

相關問題