recently I wrote some code to fetch user info from active directory . But DirectoryEntry is not working in .asp file . I added in reference and set copy to local is true . I changed my project framework from 4.5.2 to 4.5 but nothing works . Can antone tell me how to solve this issue


CODE

Dim ldapPath, adminAccount, adminPwd
adminAccount = "*****"
adminPwd = "******"
strServerName = "LDAP://***********"

Using rootEntry As New DirectoryEntry(strServerName, adminAccount, adminPwd)
Using searcher As New DirectorySearcher(rootEntry)
searcher.Filter = "(&(OU=*******))"
Dim result As SearchResult = searcher.FindOne()
Dim fields As ResultPropertyCollection = result.Properties
For Each ldapField In fields.PropertyNames
For Each myCollection In fields(ldapField)
Session(ldapField) = myCollection.ToString()

Next
Next
End Using
End Using

But DirectoryEntry doesn't work at all . It throws error like Microsoft VBScript compilation error '800a0401' .

Error Microsoft VBScript compilation error '800a0401'