Hello,
I'm having trouble changing a user's password in LDAP using ASP .Net 2.0 / C#.
The LDAP server is: OpenLDAP on Red Hat 4EL.
The code is as follows:
de = new DirectoryEntry(ldapPath, ldapUsername, ldapPassword);
de.AuthenticationType = AuthenticationTypes.Server
Bind;
DirectorySearcher srch = new DirectorySearcher(de);
srch.Filter = "(CN=user.name)";
SearchResult result = srch.FindOne();
if (result != null)
{
// User found, try to reset their password
try
{
DirectoryEntry user = result.GetDirectoryEntry()
;
user.Invoke("setPassword",
new object[] { newPassword });
de.CommitChanges();
}
.
.
.
The error occurs at this line:
user.Invoke("setPassword",
new object[] { newPassword });
and returns these exceptions:
Exception.Message = Exception has been thrown by the target of an invocation.
Exception.InnerException.M
essage = The directory property cannot be found in the cache.
Thank you in advance for your help!
Tim
Start Free Trial