title: User authentication over LDAP in asp
body: <p>I want to pass username and password to LDAP and retrieve user information. I have code below but don't know where must I add password string in it?</p>
  
  <pre><code>strUsername = Request.Form("username")
  strPassword = Request.Form("password")
  
  Set rootDSE = GetObject("LDAP://RootDSE")
  Set oConn = CreateObject("ADODB.Connection")
  
  sDomainContainer = rootDSE.Get("defaultNamingContext")
  Debug "DomainContainer: " &amp; sDomainContainer
  oConn.Properties("Encrypt Password") = true
  oConn.Provider = "ADSDSOObject"
  oConn.properties("user id") = sLdapReaderUsername
  oConn.properties("password") = sLdapReaderPassword
  
  oConn.Open "ADs Provider"
  
  sQuery = "&lt;LDAP://" &amp; sDomainContainer &amp; "&gt;;(sAMAccountName=" &amp; strUsername &amp; ");adspath,mail,displayName;subtree"
  
  Set userRS = oConn.Execute(sQuery)
  
  If Not userRS.EOF and not err then
      sFullName = userRS("displayName")
      sEmail = userRS("mail")
      sExternalID = ""
      sOrganization = ""
  
      Response.Write("sFullName: "&amp;sFullName)
      Response.Write("sEmail: "&amp;sEmail)
  .
  ..
  ...
  </code></pre>