ASP.NET - Admin Force Password Reset

I currently have a functional website with user password reset in case they forget their password.  In addition to that I want to be able to click a button on my admin panel and force a password reset for a site user and generate an email with the random generated password for them to login.

How would I go about that?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Does you site required user to have secret question/answer?
You can programatically, reset the password to something new using the technique shown in this article and then email the password. Here's the snippet:

string username = "user";
string password = "pass@word"; //you can generate this randomly
MembershipUser mu = Membership.Providers["SqlMembershipProviderOther"].GetUser(username);
mu.ChangePassword(mu.ResetPassword(), password);
//send email with the password above

Open in new window

Shade22Author Commented:
Yes. It runs off the .NET Membership in Visual Studios, so it requires the secret question and answer.  I was trying to figure how I would send that secret question data, or bypass the questions and generate a new password and automatically send it to the registered email address.
The article in my previous comment shows how you can bypass the q&a and reset the password.
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Shade22Author Commented:
The article was almost there, but I am looking to reset the users password as an Admin and have it generate an email to the user so that they can log in with their generated temporary password and change it.
May be I am misunderstanding but you use that code to reset the password. So you will have a page with a username textbox and a button. Admin enters the username and on button click get the user object for that username and reset the password.

Here's a website for all you need to know about sending email in .NET.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Shade22Author Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.