Click here to Skip to main content
15,885,754 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
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:

C#
/// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class Login : Window
    {
        public Login()
        {
            InitializeComponent();
            AddData adminScreen = new AddData();

           

            string username = textBoxUsername.Text;
            string password = Convert.ToString(passwordBox.Password);

            DirectoryEntry entry = new DirectoryEntry("LDAP://corporate.adcorp.com/xyz.com/dc=xyz,dc=com", username, password);
            try
            {
                Object obj = entry.NativeObject;
                DirectorySearcher search = new DirectorySearcher(entry);
                search.Filter = ("(sAMAccountName=" + username + ")");
                search.PropertiesToLoad.Add("cn");
                SearchResult result = search.FindOne();
                if (result != null)
                {
                    adminScreen.Show();
                    this.Close();
                }

            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }            
    }
Posted
Updated 15-Feb-13 3:01am
v3

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.
 
Share this answer
 
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
 
Share this answer
 
Comments
fjdiewornncalwe 15-Feb-13 9:26am    
+5.
Espen Harlinn 15-Feb-13 9:35am    
Thank you, Marcus :-D

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900