Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
I have been trying to authenticate username and password using LDAP, but I get a Message Box showing Unknown Error:(0x80005000).Once I close the Unknown Error Message Box it displays the Login screen but does not perform authentication.
Please suggest some solution
The code which I have used is as follows:
/// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class Login : Window
        public Login()
            AddData adminScreen = new AddData();
            string username = textBoxUsername.Text;
            string password = Convert.ToString(passwordBox.Password);
            DirectoryEntry entry = new DirectoryEntry("LDAP://,dc=com", username, password);
                Object obj = entry.NativeObject;
                DirectorySearcher search = new DirectorySearcher(entry);
                search.Filter = ("(sAMAccountName=" + username + ")");
                SearchResult result = search.FindOne();
                if (result != null)
            catch(Exception ex)
Posted 15-Feb-13 3:43am
Edited 15-Feb-13 4:01am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

It's not unknown, 0x80005000 means that "The specified directory service attribute or value does not exist". It will sometimes occur under a heavy load, when the global catalog server may fail to authenticate a client by using Kerberos.
Best regards
Espen Harlinn
Marcus Kramer at 15-Feb-13 9:26am
Espen Harlinn at 15-Feb-13 9:35am
Thank you, Marcus :-D
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

I found a bunch of occurrences of 0x80005000 Google Search. Here's one of them: 0x80005000 using LDAP in VBScript - caused by forward slash ("/") in a group name.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 484
1 Peter Leow 443
2 Kornfeld Eliyahu Peter 310
3 Sergey Alexandrovich Kryukov 298
4 Maciej Los 230

Advertise | Privacy | Mobile
Web01 | 2.8.150301.1 | Last Updated 15 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100