connecting problem in vb.net with ldap to active directory

Joined
Sep 26, 2016
Messages
3
Reaction score
0
I am upgrading our servers and .net application from windows 2000 to the newly-purchased windows 2012R2 servers. There is one function which works in windows 2000 but doesn’t work in windows 2012R2.

I am running an .net 2.0 internal application in windows 2000 and IIS 5.0 using Visual Studio professional 2015. There is one function in this application which will make a function call to an AD server using LDAP to check the login id and password in Active Directory. It is running perfectly fine before. However, once I upgrade to this new window2012R2 server running .net 2.0, it doesn’t work. The function in the application is not able to get authorization in the Active Directory. The function as below:

Private Function IsAuthenticatedByAD(ByVal sUid As String, ByVal sPwd As String) As Boolean

Dim direntRoot As DirectoryEntry, direntUsr As DirectoryEntry
Dim sDomain As String, sDomainAndUid As String
Dim dirsrchUsr As DirectorySearcher, oNative As Object

direntRoot = New DirectoryEntry("LDAP://rootDSE")
sDomain = direntRoot.Properties("DefaultNamingContext")(0)

sDomainAndUid = String.Format("{0}\{1}", sDomain, sUid)
direntUsr = New DirectoryEntry(direntRoot.Path, sDomainAndUid, sPwd)

Try
oNative = direntUsr.NativeObject
Catch ex As Exception
Return False
End Try

Return True

End Function


The username existed in AD and the password is correct for sure. I received error message in the "Try" section when run oNative = ....
The error message as below:

"System.DirectoryServices.DirectoryServicesCOMException (0x8007052E): The user name or password is incorrect." & vbCrLf & vbCrLf & " at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)" & vbCrLf & " at System.DirectoryServices.DirectoryEntry.Bind()" & vbCrLf & " at System.DirectoryServices.DirectoryEntry.get_NativeObject()" & vbCrLf & " at ums.business.UsrMgmtBus.IsAuthenticatedByAD(String sUid, String sPwd) in C:\inetpub\wwwroot\ums\business\UsrMgmtBus.vb:line 127"

Please help. Thanks a lot.
 

Ian

Administrator
Joined
Feb 23, 2002
Messages
19,873
Reaction score
1,499
Welcome to the forums @hakeem122 - I've had a read of your problem, but unfortunately I don't know the answer to this one.
 

Ian

Administrator
Joined
Feb 23, 2002
Messages
19,873
Reaction score
1,499
I guess that no-one here knows the answer to it unfortunately. I hope you find the answer :).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top