We help IT Professionals succeed at work.
Get Started

ASP LDAP Authentication -

796 Views
Last Modified: 2013-12-24
I have tried multiple times with no luck to even come close to authenticating my ASP app to the corporate LDAP we have here.  Some of the information includes:

URI:                  ldap://serverName
Port:                   12345
Realm:            ou=lite,ou=co,dc=compName,dc=com
Webserver:   Windows 2003 Server

I have been informed that the OID doesn't allow anonymous searches. However individual users are able to provide their credentials to bind (i presume with the "CN")

Since this is going to be in basic asp, does any expert have the steps that I need to do in order to get this to work.  I have spent the past few days trying everything on the EE site, however, still having issues.  Running the ldapsearch from my cmd window works fine, however, not sure what is missing.  I've tried basic stuff such as the code below, but it is still not working.

Any help or pointers would be greatly appreciated.
Dim szError

Function VerifyUser(User,Password)
On Error Resume Next
Dim oLDAP, oUser
VerifyUser = False
Set oLDAP= GetObject("LDAP:")
If oLDAPIs Nothing Then
 szError = "No Support For The LDAP Namespace"
 Exit Function
End If

Set oUser = oLDAP.OpenDSObject("LDAP://" & _
 "Server/CN=Users,DC=microsoft,DC=com", _
 "CN=" & User & ",CN=Users,DC=microsoft,DC=com", _
 Password, 1);
If oUser Is Nothing Then
 szError = "Could Not Bind To User Object"
Else
 VerifyUser = True
End If
End Function

If VerifyUser("mark","password") Then
'verified
Else
'failed to be verified
End If

Open in new window

Comment
Watch Question
President/Principal Consultant
Commented:
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE