Obtaining server response to LDAP methods

Obtaining the server response after performing an LDAP Bind (or other actions).

Date Entered: 6/5/2002    Last Updated: 02/25/2016

The LDAP SearchResult event will fire for search responses, and the Result event will fire for responses to any other method (ie Add, Delete, Modify, etc).

In environments where events cannot be used, such as ASP, JSP, or the Scripting Edition, the SingleResultMode configuration setting will need to be set. This will cause ResultDN to only return the next result when queried. If no more results are found, querying ResultDN will return an empty string. For example:

LDAP1.DN = Request("basedn") LDAP1.Config ("SingleResultMode=true") LDAP1.Search Request("query") Dim Result, i Response.Write "<hr><pre>" Do Result = LDAP1.ResultDN if (Result <> "") then Response.Write Result + "<br>" 'The attributes of each entry are in the AttrType and AttrValue property arrays For i = 0 To LDAP1.AttrCount - 1 Response.Write LDAP1.AttrType(i) + ": " + LDAP1.AttrValue(i) + "<br>" Next End If Loop While Result <> "" Response.Write "</pre>"

We appreciate your feedback.  If you have any questions, comments, or suggestions about this entry please contact our support team at kb@nsoftware.com.