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:
Public Function ValidateADUser(ByVal Username As String, ByVal Password As String) As Boolean
'Find valid user in Active Directory
Dim Success As Boolean = False
Dim Entry As New System.DirectoryServices.DirectoryEntry("LDAP://" & domain, Username, Password, DirectoryServices.AuthenticationTypes.Secure)
Dim Searcher As New System.DirectoryServices.DirectorySearcher(Entry)
Searcher.SearchScope = DirectoryServices.SearchScope.OneLevel
Try
Dim Results As System.DirectoryServices.SearchResult = Searcher.FindOne
Success = Not (Results Is Nothing)
Catch ex As Exception
Success = False
End Try
Return Success
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.