This is a discussion on "I need to access the windows NT 4.0 user password information adn reset it in my App" within the Introduce Yourself section. This forum, and the thread "I need to access the windows NT 4.0 user password information adn reset it in my App are both part of the Community category.
|
|
|
|
|
![]() |
||
I need to access the windows NT 4.0 user password information adn reset it in my App
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
I need to access the windows NT 4.0 user password information adn reset it in my App
I want to reset the Password of users of Company 2 who are in Windows NT domain with a web application using ASP.NET 1.1 with C#.
Is the below code works fine or do I need to try some thing else, please helps me with this request. DirectoryEntry de = GetDirectoryObject(); DirectorySearcher deSearch = new DirectorySearcher(); deSearch.SearchRoot = de; deSearch.Filter = "(&(objectClass=user)(sAMAccountName=" + UserName + "))"; deSearch.SearchScope = SearchScope.Subtree; SearchResult results = deSearch.FindOne(); if (!(results == null)) { de = new DirectoryEntry(results.Path); return de; } else { return null; } } ///<summary> /// This method enables account in AD ///</summary> ///<param name="oDE">directoryEntry - oDE</param> private void EnableUserAccount(DirectoryEntry oDE) { oDE.Properties["userAccountControl"].Value = _userStatus.Enable; oDE.CommitChanges(); oDE.Close(); } ///<summary> /// This method enables resetting password on next login ///</summary> ///<param name="oDE">directoryEntry - oDE</param> private void EnableResetPasswordNextLogin(DirectoryEntry oDE) { oDE.Properties["pwdLastSet"].Value = 0; oDE.CommitChanges(); oDE.Close(); } ///<summary> /// This method resets user password ///</summary> ///<param name="oDE">directoryEntry - oDE</param> ///<param name="Password">string NewPassword</param> private void SetUserPassword (DirectoryEntry oDE, string Password) { object ret = oDE.Invoke("SetPassword", new object[] {Password}); } ///<summary> /// This method enables account in AD ///</summary> ///<param name="userName">string userName</param> public void EnableUserAccount(string userName) { try { EnableUserAccount(GetUser(userName)); } catch(Exception ex) { log.Error(ex); throw; } } ///<summary> /// This method enables resetting password on next login ///</summary> ///<param name="userName">string username</param> public void EnableResetPasswordNextLogin(string userName) { try { EnableResetPasswordNextLogin(GetUser(userName)); } catch(Exception ex) { log.Error(ex); } } ///<summary> /// This method sets new password in AD ///</summary> ///<param name="userName">string Username</param> ///<param name="newPassword">string Password</param> public void SetPassword(string userName, string newPassword) { try { DirectoryEntry de = GetUser(userName); SetUserPassword(de, newPassword); de.CommitChanges(); } catch(Exception ex) { log.Error(ex); throw; } } References: Overview: I have two companies in the Network Diagram Company one is on Windows NT 4.0 setup and Company 2 on Windows 2000 setup. The servers in company 2 are 2000 (service pack 4) using Active Directory in native mode (Not Mixed Mode) with sites/subnets/branch. |
|
|
|
|||
|
Re: I need to access the windows NT 4.0 user password information adn reset it in my
Welcome to WebForumz
Last Blog Entry: Blog Noughts and Crosses (Nov 14th, 2007)
|
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Forgot password and Change password PHP script | Chono | PHP Forum | 4 | May 16th, 2008 09:13 |
| ASP Multi users Access to Microsoft Access | ish | Classic ASP | 0 | Apr 26th, 2007 20:05 |
| Password and User Log On Problem | stonerose | PHP Forum | 6 | Jan 10th, 2007 17:35 |
| UPDATE information in access problem | KingIsulgard | Classic ASP | 1 | Jan 31st, 2006 13:09 |
| password protection on ms access | spinal007 | Databases | 6 | May 10th, 2004 20:05 |