The authentication mechanism is unknown when connecting to Active Directory

Posted on 2009-02-24
Last Modified: 2012-05-06

I'm using the code below to search in our Active Directory.
I get the response:
"The authentication mechanism is unknown."
The server that is running the code is NOT a domain member.

Been searching around, but I can't find an explanation of what is causing the error.

private string LDAPConn = "LDAP://";

DirectoryEntry de = new DirectoryEntry(LDAPConn, "DOMAIN\username", "password", AuthenticationTypes.Secure);

DirectorySearcher deSearcher = new DirectorySearcher(de);

deSearcher.Filter = "(&(objectClass=user))";

deSearcher.SearchScope = SearchScope.Subtree;



	SearchResultCollection results = deSearcher.FindAll();


catch (Exception ex)


        msg.Text += ex.Message;


Open in new window

Question by:jetpak
    LVL 16

    Expert Comment

    Is the user having read access to the AD and I think the connection should be something like this..

    Open in new window


    Accepted Solution

    I managed to solve the main problem by adding an extra backslash between the domain and username in the login credentials.

    sunithnair: You were right about the connection string. I needed to add the extra part in order for the search to return the right stuff.
    DirectoryEntry de = new DirectoryEntry(LDAPConn, "DOMAIN\\username", "password", AuthenticationTypes.Secure);

    Open in new window


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    In my previous article ( we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
    This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now