

Web na reset hesla uživatele v Active Directory
Chtěl bych všechny programátory poprosit o pomoc s tímto:
Chtěl bych vytvořit webové rozhraní, které bude dostupné jen ve vnitřní síti a administrátorům domény umožní reset hesla u uživatelů, kteří heslo zapomněli. Našel jsem tento kód a ptám se, jestli je správně a funkční s Active Directory (windows server 2003 level) na Windows Serveru 2008 R2. Pokud ano, tak jak bych ho měl zaimplementovat do stránky ASP.
const int ADS_UF_ACCOUNTDISABLE = 0x0002;
string pathname = "WinNT:/zs.slapanov.cz/NetID,user";
DirectoryEntry user = new DirectoryEntry(pathname);
//Optionally provide credentials to connect to SAM
//user.Username = "DOMAIN\\User";
//user.Password = "password";
user.AuthenticationTypes = AuthenticationTypes.Secure;
//Reset Password
user.Invoke("SetPassword", new object[]{"newpassword"});
//Enable account
int flags = user.Properties["userAccountControl"].Value;
user.Properties["userAccountControl"].Value = flags & ~ADS_UF_ACCOUNTDISABLE;
user.CommitChanges();
//Change Password at next logon
user.Properties["passwordExpired"][0] = 1;