Dear All
I have a problem with LDAP
i canno't connect to ldap from my machine
and this is my code
<%@ Language=VBScript %>
<%
Option Explicit
response.buffer = true
Dim con,rs,Com,objADsPath,objRootOU,objDomain,objADOU, rootDSE,dso,user,pass
rootDSE="sund.cyberia.net.sa:389/ou=mail policies,dc=ogertel,dc=com"
Set objRootDSE = GetObject("LDAP://sund.cyberia.net.sa:389/ou=mail policies,dc=ogertel,dc=com")
Objdomain=objRootDSE.Get("defaultNamingContext")
Set con = Server.CreateObject("ADODB.Connection")
con.provider ="ADsDSOObject"
objADsPath =Objdomain.Get("DefaultNamingContext")
response.write objADsPath
Set objDomain = Nothing
con.open "objADsPath","cn=root","FriDec722:12:13GMT2001 "
Set Com = CreateObject("ADODB.Command")
Set Com.ActiveConnection = con
Com.CommandText ="select mailid from 'LDAP://"+objADsPath+"' WHERE mail='
[email protected]'"
Set rs = Com.Execute
Do While Not rs.EOF Or rs.BOF
ReturnValue = rs.Fields(0)
If IsArray(ReturnValue) Then
For I = LBound(ReturnValue) To UBound(ReturnValue)
If ReturnValue(I) <> "" Then
Response.Write ReturnValue(I) & "<BR>"
End If
Next
Else
Response.Write ReturnValue & "<BR>"
End If
rs.MoveNext
Loop
%>
regards