I need to access the windows NT 4.0 user password information adn reset it in my App

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.



Go Back   Webforumz.com > Community > Introduce Yourself

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old May 23rd, 2007, 05:39
New Member
Join Date: May 2007
Location: Hyderabad
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
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.
Attached Files
File Type: doc Forum Help.doc (485.5 KB, 3 views)
Reply With Quote

  #2 (permalink)  
Old May 23rd, 2007, 10:22
Reputable Member
Join Date: Oct 2006
Location: United Kingdom
Age: 20
Posts: 238
Blog Entries: 6
Thanks: 0
Thanked 0 Times in 0 Posts
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)
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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


All times are GMT. The time now is 03:56.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43