Hi Experts !
I need help with AD connectivity. I followed the instruction from this link:
The only difference in my code is that I converted it to VB.NET and use code-behind when possible.
I'm able to compile and run the web app, but when I tried to 'login' (using correct credential) it returns with this error:
A referral was returned from the server
If I use the wrong credential it returns:
Logon failure: unknown user name or bad password
And it occurred on this line (when it tries to bind):
Dim obj As Object = entry.NativeObject
I have double and tripled checked with the link above in case I have missed something.
My guess is that I don’t have the proper LDAP syntax?
If my domain name is golucky, here’s what I have for LDAP:
Dim adPath As String = "LDAP://DC=golucky,DC=com"
Domain Controller is on a Win 2003, and web app is on a different dev workstation (XP Pro).
Public Function IsAuthenticated(domain As String, username As String, pwd As String) As Boolean
Dim domainAndUsername as String = domain + "\" + username
Dim entry As New DirectoryEntry(_path, domainAndUsername, pwd)
'Bind to the native AdsObject to force authentication.
Dim obj As Object = entry.NativeObject '<-- Error Here
Dim search As New DirectorySearcher(entry)
search.Filter = "(SAMAccountName=" + username + ")"
Dim result As SearchResult = search.FindOne()
If result Is Nothing Then
'Update the new path to the user in the directory.
_path = result.Path
_filterAttribute = CType(result.Properties("c
Catch ex As Exception
Throw New Exception("Error authenticating user. " + ex.Message)
End Function 'IsAuthenticated
Any help or guidance you can provide is really appreciated !