Click here to Skip to main content
12,996,849 members (129,210 online)
Rate this:
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 2:43am
Updated 15-Feb-13 3: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 15-Feb-13 9:26am
Espen Harlinn 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
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170622.1 | Last Updated 15 Feb 2013
Copyright © CodeProject, 1999-2017
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