Using LDAP for authenication
I have always used my on security managed in a database for user authentication in my applications. I am now trying to switch to using ldap and could use some help. I am not sure if i am mistaken on how this works but i think this is how it goes: I connect to my ldap using a username and password that has permission to guerry/access ldap. In other words this would be the username and password i would use to connect to the SQL server if i was using that to authenticate. I then capture the username and password of the user via a couple of text boxes and this is where i get stuck. How do i pass those user credentials to ldap to verify the username and password match.. here is the code that i have now that connect to ldap: Thanks for any help!
Dim uid As String = "CN=web_system,OU=LDAP,OU=Service Accounts,DC=ACN,DC=ad,DC=usla,DC=edu"
Dim password As String = "!8?safasdfasd@dsafsadf"
Dim root As DirectoryEntry = New DirectoryEntry( _
"LDAP://directory.xxx.edu", uid, password, _
' attempt to use LDAP connection
Dim connected As Object = root.NativeObject
' no exception, login successful
"<span style=""color:green;"">Login successful.</span>")
Catch ex As Exception
' exception thrown, login failed
"<span style=""color:red;"">Login failed.</span>")