LDAP problem -
06-14-2007
, 04:20 AM
Hi !
I'm trying to connect my web application (NET 2.0) to a Unix LDAP server.
if i try to search users everything go ok:
Dim directoryEntry As New
System.DirectoryServices.DirectoryEntry("LDAP://ip/path", "", "",
DirectoryServices.AuthenticationTypes.Anonymous)
directorySearcher1 = New
System.DirectoryServices.DirectorySearcher(directo ryEntry)
directorySearcher1.SearchScope = DirectoryServices.SearchScope.Subtree
directorySearcher1.Filter = "uid=name.surename"
Dim oSearchResult As System.DirectoryServices.SearchResult
Try
oSearchResult= directorySearcher1.FindOne()
oentry = searcResult.GetDirectoryEntry()
tot = searcResult.Properties.Count - 1
Dim myResultPropColl As
System.DirectoryServices.ResultPropertyCollection
myResultPropColl = searcResult.Properties
Dim myKey As String
For Each myKey In myResultPropColl.PropertyNames
Dim tab1 As String = " "
Response.Write(myKey + " = ")
Dim myCollection As Object
For Each myCollection In myResultPropColl(myKey)
Try
Response.Write(tab1 + myCollection.ToString + "<br>")
Catch ex As Exception
Response.Write(tab1 + " errore proprietà " + "<br>")
End Try
Catch ex As Exception
End Try
BUT i'm not able to authenticate an user with login and password....
i try with
Dim directoryEntry As New
System.DirectoryServices.DirectoryEntry("LDAP://ip/path", username,
uiserpassword, DirectoryServices.AuthenticationTypes.secure)
but it doesn't work !
ith an old DLL (LDAP2lib) i was able to do:
bindUser = oMyLDAP.BindUser(path, uid=name.surename, Password)
if bindUser was 1 the user login and password were ok, if 2 user ok password
wrong, if 3 user doesn't exists..... |