添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. Hi guys
I have a LDAP Server ("Test.dir.svc.mytest.com") and i want to check if an user with UID a PWD is certified. How to do it?
Thank you in advance!
VB Code:
  1. Public Function ValidateADUser(ByVal Username As String, ByVal Password As String) As Boolean
  2.         'Find valid user in Active Directory
  3.         Dim Success As Boolean = False
  4.         Dim Entry As New System.DirectoryServices.DirectoryEntry("LDAP://" & domain, Username, Password, DirectoryServices.AuthenticationTypes.Secure)
  5.         Dim Searcher As New System.DirectoryServices.DirectorySearcher(Entry)
  6.  
  7.         Searcher.SearchScope = DirectoryServices.SearchScope.OneLevel
  8.         Try
  9.             Dim Results As System.DirectoryServices.SearchResult = Searcher.FindOne
  10.             Success = Not (Results Is Nothing)
  11.         Catch ex As Exception
  12.             Success = False
  13.         End Try
  14.         Return Success
  15.     End Function
Here is my code and I cannot authenticate to Ldap. It is returning false.
Public Shared Function ValidateLogin_AD(ByVal UserName As String, ByVal Password As String) As Boolean
Dim Success As Boolean = False
Dim ldapServerName As String
ldapServerName = "serverName.orgName.xxx:636"
Dim path As DirectoryEntry = New DirectoryEntry("LDAP://" & ldapServerName & "/OU=People,DC=orgName,DC=xxx", UserName, Password, AuthenticationTypes.SecureSocketsLayer)
Dim Searcher As New System.DirectoryServices.DirectorySearcher(path)
Searcher.SearchScope = DirectoryServices.SearchScope.OneLevel
Dim Results As System.DirectoryServices.SearchResult = Searcher.FindOne
Success = Not (Results Is Nothing)
Catch e As Exception
Success = False
End Try
Return Success
End Function
What am I missing here? I use SSL for authentication to LDAP and hence added port 636.
Thanks! Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.