Password reset of AD LDS user

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
My code is as follows:<br/>

System.Reflection.TargetInvocationException is thrown for the following code
Inner Exception is:The directory Property cannot be found in the cache






DirectoryEntry entry = new DirectoryEntry("LDAP://localhost:5000/CN=john,OU=demusers,OU=dem,DC=gslab",null,"akhil123");<br/>
entry.RefreshCache();<br/>
<br/>
DirectorySearcher ds = new DirectorySearcher(entry);<br/>
SearchResult sr = ds.FindOne();<br/>
DirectoryEntry de = sr.GetDirectoryEntry();<br/>
de.Invoke("setPassword", "john123");<br/>
de.Properties["LockOutTime"].Value = 0;<br/>
de.CommitChanges();<br/>
de.Close();<br/>
entry.Close();
<br/>
<br/>

View the full article
 
Back
Top