I am writing a function for a web application in ASP.NET where the client is registered on the server machine, which is Windows, authenticated from local users on the server. The function that I am writing resets the users password and sends them new news. I do it like this:
String userPath = "WinNT://" + Environment.MachineName + "/" + username.Text;
DirectoryEntry de = new DirectoryEntry(userPath);
de.Invoke("SetPassword", new object[] { password });
How can I also check the flag to force the user to change his password the next time he logs in with a password sent by email? I tried using pwdLastSet like this:
de.Properties["pwdLastSet"].Value = 0;
But this, apparently, only works with LDAP, not WinNT, and I do it locally.
Do any experts know me better than me? I even tried to find a way to do this through the command line so that I could just create a process, but I also could not find a way to do this.
source
share