Hello,
I want to allow users to change their passwords for local accounts. I programmed it on laptop with XP and it works fine but when using code on W2K it fails. I have dotNET FW 1.1 loaded and have modified the machine.config so processModel runs under SYSTEM. Also I have edited the local policy on the W2K machine to allow ASPNET account to 'Act as Part of OS' and rebooted it. I use impersonation, to an account with admin privileges, for the part of the code when the password is changed . I basically followed MS KB article 306271 and changed the part from adding a user to finding the user and then invoking the ChangePassword command. Web.config is set for windows authentication.
I have hard coded the user account and old & new passwords for testing purposes.
If impersonateValidUser("admin", ".", "123456") Then
Try
Dim AD As DirectoryEntry = _
New DirectoryEntry("WinNT://" + Environment.MachineName + ",computer")
Dim NewUser As DirectoryEntry = AD.Children.Find("TestUser1", "user")
NewUser.Invoke("ChangePassword", New Object() {"1234", "4321"})
NewUser.CommitChanges()
'Dim grp As DirectoryEntry
lblError.Text = "Your password was changed."
Catch ex As Exception
lblError.Text = ex.Message
End Try
undoImpersonation()
End If
When debugging, it always fails on the ChangePassword command and the error displayed is 'Exception has been thrown by the target of an invocation'. Any ideas on why W2K doesn't like it?
Thanks for any help you can provide,
Ray