Previously, membershipprovider and roleprovider written by a foreigner were used from codeproject.com
I found it on the website and it seems to be good to use it. But it does not implement the user's personalized engine, that is, it does not support profile. The MySQL. Net connector used is
5.0.6
Currently, MySQL. Net connector is 5.2.2, which includes user programs and role providers.
Precautions during Configuration:
1. Copy mysql. Data. dll and MySQL. Web. DLL to the bin directory of the website.
MySQL. Web. dll is a necessary component of the role provider.
2. Configure web. config
For example, in the system. Web Section, configure the following:
User Management provider
<Membership defaultprovider = "mysqlmembershipprovider">
<Providers>
<Clear/>
<Add autogenerateschema = "true"
Connectionstringname = "appdbconnstring"
Enablepasswordretrieval = "false" enablepasswordreset = "true"
Requiresquestionandanswer = "true"
Applicationname = "mysite"
Requiresuniqueemail = "true" passwordformat = "hashed"
Maxinvalidpasswordattempts = "5" minrequiredpasswordlength = "1"
Minrequirednonalphanumericcharacters = "0" passwordattemptwindow = "10"
Passwordstrengthregularexpression = "" Description = "MySQL AB
Membership provider"
Name = "mysqlmembershipprovider"
Type = "mysql. Web. Security. mysqlmembershipprovider"/>
</Providers>
</Membership>
Role provider
<Rolemanager enabled = "true" cacherolesincookie = "true"
Cookiename = ". asproles"
Defaultprovider = "mysqlroleprovider">
<Providers>
<Clear/>
<Add connectionstringname = "appdbconnstring" applicationname = "mysite"
Writeexceptionstoeventlog = "false" name = "mysqlroleprovider"
Type = "mysql. Web. Security. mysqlroleprovider"/>
</Providers>
</Rolemanager>
Explanation:
(1) connectionstringname = "appdbconnstring" stores the connection string settings of the MySQL database.
(2) autogenerateschema = "true"
Set to true
When you select the "website" menu in vs for configuration, related data tables (7 in total) are automatically generated ).
(3) applicationname = "mysite"
Is the Application Identifier. If you have multiple websites on one computer, this identifier cannot be repeated; otherwise, the provider may encounter errors.
3. After the configuration is successful, you can export the user and role management tables automatically generated by MySQL to generate SQL statements for daily building of the entire system.
In this case, you can set autogenerateschema to false.
Available
MySQL query browser exports SQL statements in the form of create from tables whose names start with my_asp.
Note that the my_aspnet_schemaversion table must have a record. This table has only one field version and its value is
3. If this record is not found, the provider reports an error.
You can also save the following SQL statement as an SQL file and execute it using the source statement to add these related tables to MySQL:
/*
Database structure used by MySQL official memeber and role service providers
*/
Drop table if exists
'Cfh2008 '. 'My _ aspnet_applications ';
Create Table 'cfh2008 '. 'My _ aspnet_applications '(
'Id' int (11) not null auto_increment,
'Name' varchar (256) default null,
'Description' varchar (256) default null,
Primary Key ('id ')
) Engine = InnoDB default charset = utf8;
Drop table if exists
'Cfh2008 '. 'My _ aspnet_membership ';
Create Table 'cfh2008 '. 'My _ aspnet_membership '(
'Userid' int (11) not null default '0 ',
'Email 'varchar (128) default null,
'Comment' varchar (255) default null,
'Password' varchar (128) not null,
'Passwordkey' char (32) default null,
'Passwordformat' tinyint (4) default null,
'Passwordquestion' varchar (255) default null,
'Passwordanswer' varchar (255) default null,
'Isapschemed' tinyint (1) default null,
'Lastactivitydate' datetime default null,
'Lastlogindate' datetime default null,
'Lastpasswordchangeddate' datetime default null,
'Creationdate' datetime default null,
'Islockout' tinyint (1) default null,
'Lastlockedoutdate' datetime default null,
'Failed' passwordattemptcount 'int (10) unsigned default null,
'Failedpasswordattemptwindowstart' datetime default null,
'Failedpasswordanswerattemptcount 'int (10) unsigned default null,
'Failedpasswordanswerattemptwindowstart' datetime default null,
Primary Key ('userid ')
) Engine = MyISAM default charset = Latin1 comment = '2 ';
Drop table if exists
'Cfh2008 '. 'My _ aspnet_profiles ';
Create Table 'cfh2008 '. 'My _ aspnet_profiles '(
'Userid' int (11) not null,
'Valueindex' longtext,
'Stringdata' longtext,
'Binarydata' longblob,
'Lastupdateddate' timestamp not null default current_timestamp on
Update current_timestamp,
Primary Key ('userid ')
) Engine = InnoDB default charset = utf8;
Drop table if exists
'Cfh2008 '. 'My _ aspnet_roles ';
Create Table 'cfh2008 '. 'My _ aspnet_roles '(
'Id' int (11) not null auto_increment,
'Applicationid' int (11) not null,
'Name' varchar (255) not null,
Primary Key ('id ')
) Engine = MyISAM default charset = Latin1 row_format = dynamic;
Drop table if exists
'Cfh2008 '. 'My _ aspnet_schemaversion ';
Create Table 'cfh2008 '. 'My _ aspnet_schemaversion '(
'Version' int (11) default null
) Engine = InnoDB default charset = utf8;
Drop table if exists
'Cfh2008 '. 'My _ aspnet_users ';
Create Table 'cfh2008 '. 'My _ aspnet_users '(
'Id' int (11) not null auto_increment,
'Applicationid' int (11) not null,
'Name' varchar (256) not null,
'Isanonus us' tinyint (1) not null default '1 ',
'Lastactivitydate' datetime default null,
Primary Key ('id ')
) Engine = InnoDB default charset = utf8;
Drop table if exists
'Cfh2008 '. 'My _ aspnet_usersinroles ';
Create Table 'cfh2008 '. 'My _ aspnet_usersinroles '(
'Userid' int (11) not null default '0 ',
'Roleid' int (11) not null default '0 ',
Primary Key ('userid', 'roleid ')
) Engine = MyISAM default charset = Latin1 row_format = dynamic;
Use cfh2008;
Insert into my_aspnet_schemaversion (Version) values (3 );