How to Use membershipuser To Change Password

Source: Internet
Author: User

How to Use

Membershipuser

Change Password

 

Vkvi

Source: Qianyi Network

(Original)

 

Time:

2009-3-11

 

Perfect Integration and Enhancement

Kindeditor html

Editor

 

In

ASP. NET

The change of user password is complicated in the built-in membership.

Membershipuser

There is

Method

Changepassword

You can change the password, but you must first enter the original password. If the user has forgotten the original password,

Ask the Administrator to set a new password.

 

There are two methods to reset the password without entering the original password:

 

Method 1

 

First, in the configuration file

Enablepasswordreset

Set

True

,

Requiresquestionandanswer

Set

False

.

That is to say, allow password reset,

Do not use questions or answers

Return password. About how to set,

See:

ASP. NET

Membership-Configuration

,

In

Membership

For locked use

Reset Password

.

 

Then the code is:

 

Membershipuser user = membership. getuser ("

User Name

");

String Password = user. resetpassword ();//

Reset A Random Password

 

User. changepassword (password ,"

New Password

");//

Set with the specified password

 

Method 2

 

In this way, you do not need to disable questions and answers, but you cannot set the password to the password you want to set.

The principle is to update the encrypted string of a known password in the database to the user who wants to change the password. Steps:

 

?

 

The username that has lost the password is

Cftea

The username of another user is

Admin

The password is

1234567

,

We can

Aspnet_users

In

Cftea

And

Admin

Of

Userid

.

 

Computer Level 2 Computer Level 3 Computer Level 4 Computer Level 4 Computer Level 2 Examination

?

 

Then go to the table

Aspnet_membership

Passed

Userid

Find

Password

And

Passwordsalt

.

 

?

 

Set

Admin

Corresponding to that user

Password

And

Passwordsalt

 

Update

Cftea

Corresponding word

.

 

?

 

In this case

Cftea

The password is the same

Admin

Same.

 

If multiple applications use the same library,

First come

Aspnet_applications

Searching

To the corresponding application

Applicationid

And then

Aspnet_users

Search

Userid

The

 

Applicationid

Also

Where

Add conditions.

How to Use membershipuser To Change Password

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.