Click here to Skip to main content
12,452,344 members (55,160 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()
        {
            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 15-Feb-13 2:43am
Updated 15-Feb-13 3:01am
v3
Rate this: bad
 
good
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
  Permalink  
Comments
Marcus Kramer 15-Feb-13 9:26am
   
+5.
Espen Harlinn 15-Feb-13 9:35am
   
Thank you, Marcus :-D
Rate this: bad
 
good
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.
  Permalink  

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
Web01 | 2.8.160826.1 | Last Updated 15 Feb 2013
Copyright © CodeProject, 1999-2016
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