Last post May 05, 2011 07:59 PM by bennbobb
Mar 20, 2009 09:03 PM|rayhawk|LINK
I am trying to setup mysql to store userdata, including login, roles, etc for a web application. Of course I want to use the built in login controls and create user wizard etc. I am using VWD 2008 Express, and the Mysql .net connector 5.2.5. I have no
problems working with the mysql database in the rest of my application, but I can't get the proper communication for the membership management. I found several examples on the web, but all appeared to be targeted to Visual Studio 2005, and for earlier versions
of the mysql connector. I found two samples at codeproject, could'nt get either one to work, I tried a tutorial at
http://blog.nolanbailey.com/2008/03/08/mysql-aspnet-membership-and-role-provider/194, and I searched all over the place-including here. I am sure I am doing something wrong with my setup but I don't really know where to look. Part of my problem is I have
some files in App_code in VB, so the samples in C# don't really help me, as all files in that folder need to be the same language. The dll from codeproject seemed ok, but I would rather use the built in mysql.web.dll. I am just hoping somebody has done something
similar here and can point me in the right direction. Below are the error messages that come up no matter what I try.
When I use the example from codeproject I get this:
The following message may help in diagnosing the problem: Could not load file or assembly 'MySql.Data, Version=22.214.171.124, Culture=neutral, PublicKeyToken=c5687fc88969c44d'
or one of its dependencies. The system cannot find the file specified.
This message comes up using the example from Nolan Bailey's blog :
The following message may help in diagnosing the problem:
Could not load type 'MySql.Web.Security.MySQLMembershipProvider”'. (C:\Users\Ray\Documents\Visual Studio 2008\MySQL2\web.config line 55)
Mar 21, 2009 01:13 AM|Danny117|LINK
You can try dropping the mysqll.data.dll in the bin file of your website.
Mar 21, 2009 10:38 AM|rayhawk|LINK
Removing the file did'nt do it. But here is some more information that may help. I am going through the MySQL connector/Net help menu, and it has an article under advanced topics called ASP.NET Provider Model. I will quote it here, but basically it says
that the installer should register the (mysql) providers in my machines .net configuration file. I don't know if they mean the machine.config file on my local computer, but there is no reference to a mysql source there. Of course I followed all the steps
in this instruction, but it did'nt work. It does'nt create the dummy connection string as described. It does add an assembly in my web.config file, but it still does'nt work. I don't understand how I would specify connection to a database (user&pw) that
is automatically created? What am I missing here?
Copied From MySQL Connector/Net Help File:
MySQL Connector/Net provides support for the ASP.NET 2.0 provider model. This model allows application developers to focus on the business logic of there application instead of having to recreate such boilerplate items as membership and roles support.
Currently, only membership and role providers are supplied although session state and profile providers will be provided in upcoming releases.
The installation of Connector/Net 5.1 or later will install the providers and register them in your machines .NET configuration file. The providers are implemented in the file mysql.web.dll and this file can be found in your Connector/Net installation folder.
There is no need to run any type of SQL script to setup the database as the providers create and maintain the proper schema automatically.
The easiest way to start using the providers is to use the ASP.NET configuration tool that is available on the Solution Explorer toolbar when you have a website project loaded.
In the web pages that open you will be able to select the MySQL membership and roles provider by indicating that you want to pick a custom provider for each area.
When the provider is installed, it creates a dummy connection string named
LocalMySqlServer. This has to be done so that the provider will work in the ASP.NET configuration tool. However, you will want to override this connection string in your web.config file. You do this by first removing the dummy connection string and then
adding in the proper one. Here is an example:
<add name="LocalMySqlServer" connectionString="server=xxx;uid=xxx;pwd=xxx"/>
To use the providers on a production server you will need to distribute the MySql.Data and the MySql.Web assemblies and either register them in the remote systems Global Assembly Cache or keep them in your applications bin folder.
Mar 28, 2009 01:05 PM|rayhawk|LINK
OK, a friend helped me and we figured it out, just want to post here for others who might get stuck. Basically, the documentation in the mysql connector menu tells you the basic steps, but if you don't go into your machine.config file, and add autogenerateschema="true"
it won't work. At least with Vista, it won't let you save the machine.config file unless you give yourself specific rights over the machine.config file. Then modify as follows:
You should only need to add the autogenerateschema="true" part to make it work. It won't work in the web.config file. Then follow the rest of the instructions, or go along with the writeup at:
May 04, 2009 10:38 AM|lpaluszk|LINK
You don't have to edit machine.config file.
I found that it works while in web.config when
<members defaultProvider="MySqlMembershipProvider"> is declared.
I am writing a tutorial on using MySQL Connector with ASP.NET MVC and I have covered it in the first part
here. I am working on following parts of the tutorial on the same topic.
May 05, 2011 07:59 PM|bennbobb|LINK
Thanks for the other posts they helped me find this! It is so easy just a simple wizard!!
Figure 20.18. MySQL Website Configuration Tool