1. Add a "Bin" ASP.NET folder to your project and copy the file MySQl.Data.dll in to it.
You can obtain this file by downloading the latest version of the MySQL Connector/NET (http://dev.mysql.com/downloads/connector/net/), installing it, then locate the file in the installation folder.
2. In your web.config file add a connection string for your database, for example:
<add name="Any-name" connectionString="Server=server-name-or-ip;Port=3306;Database=database-name;Uid=username;Pwd=password;" providerName="MySql.Data.MySqlClient" />
3. In your code you can then open a connection to your database:
var db = Database.Open("Any-name");
If you get the error message "Unable to find the requested .Net Framework Data Provider. It may not be installed." then you will also need to add some extra lines to web.config.
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory,MySql.Data" />
by John Avis | August 18, 2020
I have an old website written in ASP.NET v4.x Web Pages v188.8.131.52 and when I upload changes to my shared hosting provider some cshtml files update fine and I can see the changes, but some do not.
by John Avis | May 6, 2020
If you are having intermittent problems sending email in .NET using System.Net.Mail consider switching libraries.