主要是 strvaliddn 參數,請參考貴單位的設定。
<%
struser= "user帳號"
strpwd= "user密碼"
strvaliddn= "cn=" & struser & ",ou=unit,o=users"
strservername="192.xx.xx.xx:389"
Set conn = CreateObject("ADODB.Connection")
conn.Provider = "ADsDSOObject"
conn.Open "ADs Provider", strvaliddn, strpwd
Set objldap = CreateObject("ADODB.Command")
objldap.ActiveConnection = conn
on error resume next
objldap.CommandText = "Select cn FROM 'LDAP://" & strservername & "/" & strvaliddn & "' "
set rs = objldap.Execute
If rs.eof or rs.bof then
authresult="N"
else
authresult="Y"
end if
response.write authresult
set objldap=nothing
set rs=nothing
Set conn=nothing
%>
沒有留言:
張貼留言