DirectoryEntry _directoryEntry = new DirectoryEntry(ldapPath, user, pwd, AuthenticationTypes.Secure); public bool ChangePassword(string userPath, string newPassword) { try { if (userPath != null && _directoryEntry != null) { _directoryEntry.Path = userPath; //Set the password _directoryEntry.Invoke("SetPassword", new object[] { newPassword }); _directoryEntry.CommitChanges(); return true; } } catch (Exception ex) { //Invalid Login or the domain controller is not contactable throw ex; } finally { _directoryEntry.Close(); _directoryEntry = null; } return false; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)