locked
Authenticating with ADAM from ASP.NET RRS feed

  • Question

  • User1488654740 posted

    Hi all

    I am having trouble authenticating to ADAM from asp.net web forms. I have followed the instructions on installing and configuring my ADAM instance and I can authenticate using the ldp tool for the Admin User I created but I cannot authenticate to ADAM from within ASP.NET. Below is the error I keep getting

    System.DirectoryServices.DirectoryServicesCOMException: The directory service is unavailable.

    Here is the code I am executing

    #####################################################################################
    public
    bool isAuthenticated(string username, string password)

     DirectoryEntry entry = new DirectoryEntry("LDAP://localhost:389/CN=Users,O=Arroen,C=US",username, password);

    Object obj = entry.NativeObject;return true;
    #####################################################################################

    Something really basic, I have been battling this for about a week and I have no idea what is wrong.

    Any help would be appreciated. 

    I also need to mention I am new to ADAM, so it might be someting that I am overlooking

    Thanks in advance. 

    Wednesday, April 14, 2010 8:18 PM

All replies

  • User197322208 posted

    1. see if in services.msc the ADAM service is started

    2.search for ADSI explorer and try to connect to ADAM at LDAP://localhost:389/

    Thursday, April 15, 2010 7:07 AM
  • User1488654740 posted

    1. The service is running 

    2. I can connect using ADSI edit and ldp

    But I still get the message when I run the code

    Thursday, April 15, 2010 7:35 AM
  • User2091822704 posted

    Hi use this code:

    Public Shared Function AutentificacionUser(ByVal UserName As String, ByVal Password As String) As boolean
             Try
                Dim objGrp As DirectoryEntry = New DirectoryEntry
                Dim entry As DirectoryEntry = New DirectoryEntry
                entry.Path = System.Configuration.ConfigurationManager.AppSettings("RootAD").ToString()
                entry.Username = UserName
                entry.Password = Password
                entry.AuthenticationType = AuthenticationTypes.ServerBind

                Dim dirSearch As DirectorySearcher = New DirectorySearcher(entry)

                dirSearch.Filter = "(&(objectClass=user)(cn=" + UserName + "))"

                Dim searchResults As SearchResult = dirSearch.FindOne()
                Return True


                Catch ex As Exception
                Return False
            End Try
        End Function


    Settings in ADAM:

    1. dSHeuristics=0000000001001
    2. The user need the role: Readers


    Wednesday, April 21, 2010 11:21 AM