PLEASE HELP!!! LDAP authentication

  • Thread starter Thread starter walter
  • Start date Start date
W

walter

Hi All

I am trying to Authenticate a user from Novell LDAP using the code below. I
can successfully Connect to the LDAP Server, but get the following error
message as soon as I hit the search command:- (a) Server did not send any
data.

Imports System
Imports System.Text
Imports System.Collections
Imports System.DirectoryServices

Public Function AuthenticateUser(ByVal Username As String, ByVal Password As
String) As Collection
Dim dirSearch As New DirectorySearcher
Dim resultSet As SearchResultCollection
Dim result As SearchResult
Dim resultFields() As String = {"SecurityEquals", "cn"}

With dirSearch
.SearchRoot = New DirectoryEntry("server1.com", "username",
"password")
.PropertiesToLoad.AddRange(resultFields)
.Filter = "cn=*"
End With

Try
resultSet = dirSearch.FindAll()
If (resultSet.Count > 0) Then
For Each result In resultSet
'// display results here
Next
Else
'// display error message
End If
Catch ex As Exception
throw ex
Finally
dirSearch = Nothing
End Try
End Function
 
With dirSearch
.SearchRoot = New DirectoryEntry("server1.com", "username",
"password")

Well, for starters, this is DEFINITELY *NOT* a valid LDAP path here!

Check out your LDAP paths - you'd have to have something like
LDAP://dc=server1,dc=com as your first parameter to the
"DirectoryEntry" constructor here.

Marc
================================================================
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
 
Back
Top