connecting problem in vb.net with ldap to active directory

Discussion in 'ASP General' started by hakeem122, Sep 26, 2016.

  1. hakeem122

    hakeem122

    Joined:
    Sep 26, 2016
    Messages:
    2
    Likes Received:
    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.
     
    hakeem122, Sep 26, 2016
    #1
    1. Advertisements

  2. hakeem122

    hakeem122

    Joined:
    Sep 26, 2016
    Messages:
    2
    Likes Received:
    0
    I am stuck and really desperate. Can anyone please help? I appreciate that.
     
    hakeem122, Sep 27, 2016
    #2
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andrew
    Replies:
    1
    Views:
    833
    Kevin Spencer
    Jun 24, 2004
  2. Tdar
    Replies:
    2
    Views:
    9,483
    Arnel
    Oct 11, 2005
  3. =?Utf-8?B?bXVsdGlzeW5j?=

    Connecting to Active Directory through ASP.NET Web form

    =?Utf-8?B?bXVsdGlzeW5j?=, Nov 24, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    2,895
    =?Utf-8?B?bXVsdGlzeW5j?=
    Nov 25, 2005
  4. Ken Dourado

    Active Directory, LDAP and Forms Authentication Problem

    Ken Dourado, Nov 10, 2003, in forum: ASP .Net Security
    Replies:
    0
    Views:
    383
    Ken Dourado
    Nov 10, 2003
  5. Andrew

    Problem querying LDAP and/or Active Directory

    Andrew, Jun 23, 2004, in forum: ASP .Net Security
    Replies:
    1
    Views:
    499
    Joe Kaplan \(MVP - ADSI\)
    Jun 24, 2004
  6. Daniel Berger
    Replies:
    4
    Views:
    390
    Daniel Berger
    Oct 22, 2007
  7. A. Farber
    Replies:
    1
    Views:
    1,246
    A. Farber
    Mar 13, 2009
  8. Abhinn

    how to change font syle in bluej

    Abhinn, Aug 28, 2016, in forum: Introductions
    Replies:
    0
    Views:
    621
    Abhinn
    Aug 28, 2016
Loading...