PLEASE HELP!!! LDAP authentication

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
 
M

Marc Scheuner [MVP ADSI]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top