/ Published in: ASP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
sLdapReaderUsername = "RemoteDomain\user" sLdapReaderPassword = "password" ' Retrieve authenticated user strUsername = split(Request.ServerVariables("LOGON_USER"),"\")(1) Debug Request.ServerVariables("LOGON_USER") & " - should be of the form DOMAIN\username - if blank, your IIS probably allows anonymous access to this file." Set rootDSE = GetObject("LDAP://RemoteDC/RootDSE") Set oConn = CreateObject("ADODB.Connection") sDomainContainer = rootDSE.Get("defaultNamingContext") Debug "DomainContainer: " & sDomainContainer oConn.Provider = "ADSDSOObject" oConn.properties("user id") = sLdapReaderUsername oConn.properties("password") = sLdapReaderPassword oConn.Open "ADs Provider"