Authenticate users in the Domino LDAP from an ASP web page

I am trying to query the Domino LDAP from an ASP web page on our website, to authenticate users. With the ASP I am using, all I can get in return is table not found.

Would you know of any ASP code examples, good

resources for notes or reason why It wont work?

thanks,

Ian

Subject: Authenticate users in the Domino LDAP from an ASP web page

I am trying to query the Domino LDAP from an ASP web page on our website, to authenticate users. With the ASP I am using, all I can get in return is table not found.

Would you know of any ASP code examples, good

resources for notes or reason why It wont work?

Sorry, I’m not familiar with ASP’s LDAP interface.

But to make sure that you at least have the LDAP search’s base, filter, scope correct, you can try using the arguments with the standalone ldapsearch.exe utility. Search for “ldapsearch” it in the Directory FAQ

http://www-10.lotus.com/ldd/nd6forum.nsf/DateAllThreadedweb/5c4bf25f844b9ac785256e4c005998b7?OpenDocument

Subject: Authenticate users in the Domino LDAP from an ASP web page

Hi Ian,

I am not a expert in ASP programming but I thought I would take a shot at it and here is what I came up with. Not pretty but it works.

This code is designed to preform a domino ldap lookup and can also be used for authenication.

You will need:

IP works -installation required

  1. http://www.nsoftware.com/default.aspx

  2. Click on Platforms / IDEs → ASP

  3. Select IP*Works!V6 ASP Edition

  4. Trial version will work.

Let me know if it works for you.

Ted Ford

ewizard2@cox.net

				 <tr><td>LDAP Server: <td><input type="text" name="server" value="mcd01" size="30">

				 <tr><td>Query:<td><input type="text" name="query" value="" size="50">

				 <tr><td>Pass:<td><input type="password" name="myPassword" size="50">

				 <tr><td><td><input type="submit" value="Search!">

<%

If Request(“REQUEST_METHOD”) = “POST” Then

Dim ldap

Set ldap = Server.CreateObject(“IPWorksASP6.LDAP”)

ldap.ServerName = Request.Form(“server”) 'LDAP Server Name from Request form

ldap.SearchSizeLimit = 100

'at most 100 results

password = Request.Form(“myPassword”)

'retrieving password from request form

username = Request.Form(“query”)

'retrieving username from request form

 if ( password = "" )  then				

 	password = "nopassword"						

 end if

 if ( username = "" ) then

 	username = "no user"

 end if 

ldap.dn = username

'User name used for Ldap session

ldap.password = password

'password used for Ldap session

ldap.bind

'establishing a session with ldap.

’ if result code is 0 and description is OK then you have a successful login. If result code is 49 and description

’ is "Invalid Credentials, then you will be bounded as anonymous

if ldap.NextResult = 0 then

’ if result code is 0 and description is ok = sucessful login

if ldap.ResultDescription = “[ok]” then

Response.Write(“it worked”)

’ set the required attributes

ldap.AttrCount = 1

ldap.AttrType(0) = “mail”

'email for addresses etc…

ldap.Search “cn=” & Request.Form(“query”)

While ldap.NextResult = 1

'1 is a search result

Response.Write "
Found Name: " & ldap.ResultDN & Chr(13) & Chr(10)

Response.Write "
Found Email: " & ldap.AttrValue(0) & Chr(13) & Chr(10)

Wend

else

Response.Write(“Not Authorized”)

end if

end if

’ Response.Write(“
” & ldap.ResultCode)

’ use the above statement to see result code

Response.Write “”

End If

%>