i want to validate user and password.i code below: DirectoryEntry de = new DirectoryEntry(LDAPPath); DirectorySearcher search = new DirectorySearcher(de); search.Filter = "(&(objectclass=user)(cn=" + userID + "))";
SearchResult sr = search.FindOne(); if (sr != null) { string userDN = sr.Properties["distinguishedname"][0].ToString(); DirectoryEntry de2 = new DirectoryEntry(sr.Path, userDN, password); try { de2.RefreshCache();
Console.WriteLine("success"); } catch (System.Exception a) {
Console.WriteLine(a.Message); } }it always output the error message even userid and password were matchedappreciated for helping