3
我正在使用vb.net,我想檢查某個特定用戶是否存在於Active Directory中。如果是這樣,我想顯示特定用戶的詳細信息。怎麼做?檢查用戶是否存在於Active Directory中
用戶的登錄憑據是通過文本框控件傳遞
我的代碼:
Dim de As DirectoryEntry = GetDirectoryEntry()
Dim ds As DirectorySearcher = New DirectorySearcher(de)
ds.Filter = "(&(objectClass=txt1.text))"
' Use the FindAll method to return objects to SearchResultCollection.
results = ds.FindAll()
Public Shared Function GetDirectoryEntry() As DirectoryEntry
Dim dirEntry As DirectoryEntry = New DirectoryEntry()
dirEntry.Path = "LDAP://ss.in:389/CN=Schema,CN=Configuration,DC=ss,DC=in"
dirEntry.Username = "ss.in\ssldap"
dirEntry.Password = "[email protected]"
'Dim searcher As New DirectorySearcher
'searcher.SearchRoot = dirEntry
Return dirEntry
End Function
如果我通過了密碼。這段代碼是正確的嗎?我是AD新手。請幫我做這個?
好的非常感謝你。我會嘗試並回復你後者 – vps
是我在aspx.vb中包含任何名稱空間頁 – vps
我應該在哪裏傳遞域參數@marc_s – vps