The membership. createuser method is associated with the membership defaultprovider in Web. config.

Source: Internet
Author: User

 

The code for the custom registration interface has been mentioned in the previous blog. When I tested it again today, I found that the user password created today is in the MD5 format, which shows my web. the default membership defaultprovider in config is modified to mysqlmembershipprovider,

The following code is displayed on the testcreateusers. ASPX page:

Membershipuser newuser = membership. createuser (usernametextbox. Text, passwordtextbox. Text, <br/> emailtextbox. Text, passwordquestion, <br/> passwordanswer, true, out status );

Actually, it is called in my custom mysqlmembershipprovider

Public override membershipuser createuser (string username, <br/> string password, <br/> string email, <br/> string passwordquestion, <br/> string passwordanswer, <br/> bool isapproved, <br/> Object provideruserkey, <br/> out membershipcreatestatus status)

Question 1:

Although I don't know what the problem is, I didn't even add mysqlmembershipprovider in testcreateusers. aspx, and I don't know how it was found.

Question 2:

As mentioned in the previous blog, user information is not added to the users table.

Question 3:

This problem has been solved. Record the error Solution Process

Originally, we thought we would use the method in mysqlmembershipprovider. Therefore, we first defined the msmp object of mysqlmembershipprovider, and then called other methods through this object, such as in testcreateusers. the requiresquestionandanswer and createuser () methods in aspx report the following error if requiresquestionandanswer is set to false:

The password retrieval answer provided is invalid. Please check the value and try again

When I change requiresquestionandanswer to true, the user information can be written to the database, but an error will still be reported. Later, this is the case mentioned above. I will not change it at all, I didn't expect this createuser to be associated with the Web. in config, membership defaprovider provider automatically converts my encryption method to MD5 mode, and writes the data to the database correctly. No error is reported.

Things to be solved

The users table is associated with the aspnet_users and aspnet_membership tables.

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.