Home Site Map Buy Email
AdvSMTP
AdvIMAP4
AdvPOP3
AdvFile
AdvZIP
AdvGraphGenerator
AdvLDAP
AdvHTTP
AdvDSN
AdvDirectory
AdvRegistry
AdvMX
ASP Components >> AdvLDAP
Download | Buy
AdvLDAP

The component allows you to perform all basic LDAP operations on LDAP (Lightweight Directory Access Protocol) directory servers like the Netscape Directory Server. Access to the component can also be turned on at web basis like all other ASPFusion components. It provides these operations.

Complete basic LDAP server operations, such as Add, Modify, ModifyDN and Delete.
Along with these operations it provides Query the LDAP entries by giving the search criteria and can sort the list in ascending, descending and case sensitive, case insensitive order on given sorting criteria.

Sample code for C++, ASP and CF is provided with the component

Example (ASP):

<% set Obj = Server.CreateObject("AdvLDAP.LDAP") %>

AdvLDAP Properties

Property Description
Attributes It is a semicolon ";" separated list of attributes against which the values should be retrieved from the LDAP server.

Example (ASP):
<% Obj.Attributes = "cn;sn;mail;telephonenumber;l" %>
ErrorReason Reports any error that occurred during the request.

Example (ASP):
<% if Obj.IsError = 1 then
        Response.Write Obj.ErrorReason
else
        No Error Occurred
end if %>
Filter It is a filter that defines the conditions that must be fulfilled in order for the search to match a given entry. Attributes are referenced in the form: "Attribute operator value". Its default value is "objectclass = *".

Example (ASP):
<% Obj.Filter = "sn = Aasher" %>
FilterFile Specifies the name of the file that contains the filter string specification. If filter string is specified in the filter file then the Filter parameter will be ignored.

Example (ASP):
<% Obj.Filter = "c:\myownfolder\myownfile.txt" %>
IsError Returns 1 if any error occurred during the request otherwise 0.

Example (ASP):
<% if Obj.IsError = 1 then
        Response.Write Obj.ErrorReason
else
        No Error Occurred
end if %>
MaxRows It is the maximum number of entries to be returned as a result of a search. If not specified then all entries are returned as default.

Example (ASP):
<% Obj.MaxRows = 5 %>
Password Password corresponds to the user name.

Example (ASP):
<% Obj.Password = "mypassword" %>
Port Optional. If not specified then default port 389 is used for communicating with LDAP server.

Example (ASP):
<% Obj.Port = 889 %>
Scope Specifies the scope of the search from the entry specified in the DN property. Valid values are

OneLevel (default) Searches all entries one level beneath the entry specified in the START attribute
Base Searches only the entry specified in the START attribute
Subtree Searches the entry specified in the START attribute as well all entries at all levels beneath it

Example (ASP):
<% Obj.Scope = "base" %>
ServerName Required. Host name or IP address of the LDAP server.

Example (ASP):
<% Obj.ServerName = "localhost" %>
Sort Indicate the attribute to sort query result by.

<% Obj.Sort = "cn" %>
SortAscending Specify sorting order of the Query results. Valid values are

TRUE (default) for ascending
FALSE for descending

<% Obj.SortAscending = false %>
SortCasesensitive Specify sorting mechanism of the Query results. Valid values are

TRUE (default) for case sensitive
FALSE for case insensitive

<% Obj.SortCasesensitive = false %>
Timeout It is the maximum time (in seconds) allowed for a search. If not specified then default value is 60.

<% Obj.Timeout = 120 %>
UserName User name required for accessing the server. If no specified then LDAP connection will be anonymous.

<% Obj.UserName = "uid = admin, o = aspfusion.net" %>

AdvLDAP Methods

Method Parameter Return Value Description
Add None None Add entries to the LDAP Server.

Example (ASP):
<% Obj.Add() %>
AttributeAdd 1. Attribute Name
2. Attribute Value
3. Value Size
None The method is used to set the value of attributes of the entry, which is to be added in the LDAP Server. To set more than one attributes call the method multiple times. AttributeName should contain the name of the attribute. AttributeValue should contain the value of the attribute. If the attribute value is not binary then the ValueSize should be -1 else it will be the size of value in bytes.

Example (ASP):
<% Obj.AttributeAdd "attributename", "attributevalue", "valuesize" %>
AttributeModify 1. Attribute Name
2. Attribute Value
3. Value Size
4. Add Flag
None The method is used to set the value of attributes of the entry, which is to be modified in the LDAP Server. To set more than one attributes call the method multiple times. AttributeName should contain the name of the attribute. AttributeValue should contain the value of the attribute. If the attribute value is not binary then the ValueSize should be -1 else it will be the size of value in bytes. If new value is to be replaced by the previous values then AddFlg must be FALSE else it must be TRUE.

Example (ASP):
<% Obj.AttributeModify "attributename", "attributevalue", "valuesize", false %>
Delete None None Deletes entries from LDAP server.

Example (ASP):
<% Obj.Delete() %>
DN 1. Attribute
2. Value
None Specifies the distinguished name of the entry on LDAP server. For going in depth in the directory tree call the method multiple time with specifying the Attribute from top to the bottom.

Example (ASP):
<% Obj.DN "attribute", "value" %>
Modify None None Modifies entries on LDAP Server with the exception of the distinguished name (DN) attribute.

Example (ASP):
<% Obj.Modify() %>
ModifyDN None None Modifies the distinguished name attribute for LDAP entries on LDAP server.

Example (ASP):
<% Obj.ModifyDN() %>
NewRDN 1. Attribute
2. Value
None Specifies the relative distinguished name of the entry on LDAP server. It must be the leaf in the directory tree.

Example (ASP):
<% Obj.NewRDN "attribute", "value" %>
Query None Array of objects Returns entries information on the basis of some search criteria.

Example (ASP):
<% set Result = Obj.Query() %>

Please view ASP template of Query method shipped with downloadable file of AdvLDAP component to check how to handle Result object returned from Query method.