Error 0x80005000 and DirectoryEntry in .NET

So I've got a project that requires I write a web app that checks against Active Directory (an ADAM instance, as it happens).

It doesn't seem to work, for the longest time.

I've got my server's address set out, I remember to use the "Distinguished Name" format of the user name, and I have the right password.  I've selected the right AuthenticationType, and I still get an exception:

"Unknown exception (0x8000500)".

Here's the code that failed:

const string adamServer = "ldap://servername:389/DC=example,DC=com";
const string adamSvcUser = "CN=userName,CN=Roles,DC=example,DC=com";
const string adamSvcPassword = "cwazqa";

protected void
subClick(string sUserName, string sPassword)
{
// Find User in ADAM
DirectoryEntry root = new DirectoryEntry(adamServer,
adamSvcUser, adamSvcPassword, AuthenticationTypes.None);

I just couldn't see anything wrong.

I'll come back and edit this post later with the answer...

EDIT...

Okay, so nobody else saw the answer either - that makes me feel better.

The answer is simply that I put "ldap://" at the start of the adamServer string.  The protocol specifier is case-sensitive.

Who thought that one up?  Is "ldap" really different from "LDAP"?  How?  To what protocol does "LDAP" refer, if not to "ldap"?

So there's your answer - the string should have been "LDAP://servername:389/DC=example,DC=com" - elements in the string other than "LDAP" are all case-insensitive.

Published Tue, Mar 28 2006 13:44 by Alun Jones

Comments

# re: Error 0x80005000 and DirectoryEntry in .NET

Change "ldap://servername:389/DC=example,DC=com"; with "LDAP://servername:389/DC=example,DC=com"; probably it will work

Friday, November 30, 2007 7:02 AM by r.c.

# re: Error 0x80005000 and DirectoryEntry in .NET

man, thank u so much! that was the answer!!!

Monday, April 07, 2008 3:04 PM by epson

# re: Error 0x80005000 and DirectoryEntry in .NET

Thanks!  That little hint just saved me a long wild goose chase!

Sunday, June 08, 2008 8:07 PM by syamane

# re: Error 0x80005000 and DirectoryEntry in .NET

Hmm, doesn't work for me, my LDAP:// is already in upper-case...

Wednesday, December 17, 2008 8:45 AM by Dany

# re: Error 0x80005000 and DirectoryEntry in .NET

Thanks, I've allready spent a few hours figuring this out!

Monday, January 19, 2009 2:32 PM by TST

# re: Error 0x80005000 and DirectoryEntry in .NET

I just spent about an hour trying to figure this out myself.  This was what my problem was.  Case sensitivity...meh!

Monday, October 19, 2009 3:20 PM by Greg

# re: Error 0x80005000 and DirectoryEntry in .NET

Hi,

Don't forget to escape "/" in adamSvcUser

Regards

Friday, May 07, 2010 12:02 PM by Frederic Dobon

# re: Error 0x80005000 and DirectoryEntry in .NET

When do you have a slash in adamSvcUser?

Friday, May 07, 2010 12:16 PM by Alun Jones

# re: Error 0x80005000 and DirectoryEntry in .NET

goood error 0X80005000

Tuesday, February 15, 2011 4:37 PM by ebrahim

Leave a Comment

(required) 
(required) 
(optional)
(required) 
If you can't read this number refresh your screen
Enter the numbers above: