Click here to Skip to main content
16,018,092 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
I Have A visual web-part of changing a password of team site(it automatically changes the password in Active directory but it is taking 3 min time to update the Active Directory in   the mean time user can able to log in into both the password new one and the old one )
1)so how to reduce the time interval
2)else is their any way to update password in active-directory
 3) Or how can i handle these time period(what i mean to say is shall  i lock the account up to new password is updated..? is it possible..?)
Posted
Comments
Bajirao_ 18-Oct-13 10:23am    
//create new local account

DirectoryEntry localMachine = new DirectoryEntry("WinNT://" +
Environment.MachineName);
DirectoryEntry newUser = localMachine.Children.Add("localuser", "user");
newUser.Invoke("SetPassword", new object[] { "3l!teP@$$w0RDz" });
newUser.CommitChanges();
Console.WriteLine(newUser.Guid.ToString());
localMachine.Close();
newUser.Close();

// if you are using code like this, then check more for CommitChanges/Invoke methods.
// Try out this :
http://www.codeproject.com/Articles/18102/Howto-Almost-Everything-In-Active-Directory-via-C

// There is the property as "IsAccountLocked" may be it is helpfull.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900