Dim RootDSE As New DirectoryServices.DirectoryEntry("LDAP://mail.local.abcdefgh.com/rootDSE", "user", "pwd", AuthenticationTypes.Secure)
Dim DomainDistinguishedName As String = RootDSE.Properties("DefaultNamingContext").Value
Dim ADEntry As New DirectoryServices.DirectoryEntry("LDAP://mail.local.abcdefgh.com/rootDSE," & DomainDistinguishedName)
ADEntry.Username = "user"
ADEntry.Password = "pwd"
All I added is AuthenticationType.secure and user login details. Apart from this I added "<identity impersonate="true"/>" in my web.config file
Marked as answer by Raj10 on May 18, 2010 06:05 PM
Raj10
Member
10 Points
25 Posts
Re: Website is not able to connect to Active Directory
May 18, 2010 06:05 PM|LINK
Finally, I managed to find the solution by myself
This is the code
Dim RootDSE As New DirectoryServices.DirectoryEntry("LDAP://mail.local.abcdefgh.com/rootDSE", "user", "pwd", AuthenticationTypes.Secure) Dim DomainDistinguishedName As String = RootDSE.Properties("DefaultNamingContext").Value Dim ADEntry As New DirectoryServices.DirectoryEntry("LDAP://mail.local.abcdefgh.com/rootDSE," & DomainDistinguishedName) ADEntry.Username = "user" ADEntry.Password = "pwd"All I added is AuthenticationType.secure and user login details. Apart from this I added "<identity impersonate="true"/>" in my web.config file