?
Solved

The authentication mechanism is unknown when connecting to Active Directory

Posted on 2009-02-24
2
Medium Priority
?
1,696 Views
Last Modified: 2012-05-06
Hi.

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://192.168.100.186";
 
DirectoryEntry de = new DirectoryEntry(LDAPConn, "DOMAIN\username", "password", AuthenticationTypes.Secure);
DirectorySearcher deSearcher = new DirectorySearcher(de);
 
deSearcher.Filter = "(&(objectClass=user))";
deSearcher.SearchScope = SearchScope.Subtree;
 
try
{
	SearchResultCollection results = deSearcher.FindAll();
}
catch (Exception ex)
{
        msg.Text += ex.Message;
}

Open in new window

0
Comment
Question by:jetpak
2 Comments
 
LVL 16

Expert Comment

by:sunithnair
ID: 23720788
Is the user having read access to the AD and I think the connection should be something like this..
LDAP://192.168.100.186/OU=testou,DC=testdc,DC=local

Open in new window

0
 

Accepted Solution

by:
jetpak earned 0 total points
ID: 23724696
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

0

Featured Post

Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Loops Section Overview
Suggested Courses
Course of the Month15 days, 20 hours left to enroll

850 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