asp.net - Force local user to change password at next login with C# -


i'm writing function web app in asp.net client logs server machine, windows authenticated against local users on server. function writing resets users password , emails them new one. so:

string userpath = "winnt://"  + environment.machinename + "/" + username.text; directoryentry de = new directoryentry(userpath); de.invoke("setpassword", new object[] { password }); 

how can check flag force user change password next time log in password emailed them? tried using pwdlastset so:

de.properties["pwdlastset"].value = 0; 

but apparently works ldap, not winnt, , doing locally.

any experts know better me? have tried looking way through command line can create process, haven't been able find way way, either.

for winnt, must set value 1 rather 0, , property name "passwordexpired" rather "pwdlastset"; see http://msdn.microsoft.com/en-us/library/aa746542(vs.85).aspx

in other words, winnt:

de.properties["passwordexpired"].value = 1; 

(it confusing, know, ldap need set property "pwdlastset" 0. how's inconsistency!)


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -