开发者

Why would LDAP query work with asp.net but not with classic asp

I'm trying to setup LDAP connection 开发者_JS百科code with another domain. My Windows server 2k3 is part of domain A. I'm trying to LDAP domain B. Now here's what I do:

test = "LDAP://CN=a,OU=Users,DC=Domain,DC=Domain"
Set connAD=getobject(test)

This gives error '80072020'

Same I do in asp.net:

DirectoryEntry user = new DirectoryEntry("LDAP://CN=a,OU=Users,DC=Domain,DC=Domain");
DirectorySearcher ds = new DirectorySearcher(user);

This works.

If I change the authentication mechanism from Integrated Windows to Basic then both work. I can't figure out what exactly is the issue.


GetObject is not for querying LDAP. You will need a COM component to query LDAP.


The way I once implemented was to use ADODB. Something like this :

set conn = Server.CreateObject("ADODB.Connection")
conn.Provider = "ADsDSOObject"
conn.Properties("User ID") = "[DOMAIN]\[USERNAME]" 
connAD.Properties("Password") = "[PASSWORD]"
connAD.Properties("Encrypt Password") = true
connAD.Open

set test = "LDAP://CN=a,OU=Users,DC=Domain,DC=Domain"

set rs = Server.CreateObject("ADODB.Recordset")
set rsADUserInfo = conn.Execute(test)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜