Creating a default ASP.NET MVC project in Visual Studio sets up a basic project where you can register a user. How would I go on changing this to use a MySQL server instead of SQLServer ?
Mysql – AccountController using MySQL in ASP.NET MVC
asp.net-mvcauthenticationMySQL
Related Topic
- Asp.net-mvc – How to properly handle 404 in ASP.NET MVC
- Asp.net-mvc – How to get ELMAH to work with ASP.NET MVC [HandleError] attribute
- Asp.net-mvc – ASP.NET MVC – Set custom IIdentity or IPrincipal
- Asp.net-mvc – ASP.NET MVC View Engine Comparison
- C# – File Upload ASP.NET MVC 3.0
- Asp.net-mvc – How to fix: Handler “PageHandlerFactory-Integrated” has a bad module “ManagedPipelineHandler” in its module list
- Asp.net-mvc – Visual Studio debugging/loading very slow
- Mysql – How to import an SQL file using the command line in MySQL
Best Answer
Got it working now.
Replace the default connection string in web.config with something like:
<add name="ApplicationServices" connectionString="server=192.168.1.30;user id=thsuser;Password=thepass;database=thedatabase" providerName="MySql.Data.MySqlClient"/>
Under the section in web.config add the following (for the 6.0.4.0 mysql connector atleast), add
<add autogenerateschema="true" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" applicationName="/" name="MySQLMembershipProvider" type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.0.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
Run the project, go back into Visual Studio and click the ASP.NET Configuration button above the solution explorer.
Navigate to "Provider Configuration"->"Select a different provider for each feature " and select the "MySQLMembershipProvider"
Works atleast for registering and logging in from a mysql database, the MySQLMembershipProvider will autogenerate the needed tables.