Mysql-ASP Membership Provider Connection

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, 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=, 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)


3/21/2009 1:03:56 AM 1929 articles. 0 followers. Follow

4 Replies

Similar Articles

[PageSpeed] 44

You can try dropping the in the bin file of your website.


Good Luck

3/21/2009 5:13:29 AM

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:

ASP.NET Provider Model Support

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.

Installing The Providers

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.

Using The Providers

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:

<remove name="LocalMySqlServer"/>
<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.


3/21/2009 2:38:50 PM

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:





<add name="MySQLMembershipProvider" autogenerateschema="true" type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Clear" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression="" />



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:

3/28/2009 5:05:06 PM

 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.



5/4/2009 2:38:09 PM

Similar Artilces:

ERROR [HY000] [MySQL][ODBC 3.51 Driver]Can't connect to MySQL server on 'IP Address of the server'(10048) ERROR [HY000] [MySQL][ODBC 3.51 Driver]Can't connect to MySQL server on 'IP of the server' (10
Hi, I am randomly getting the following error message in my application. ERROR [HY000] [MySQL][ODBC 3.51 Driver]Can't connect to MySQL server on 'IP Address of the server'(10048) ERROR [HY000] [MySQL][ODBC 3.51 Driver]Can't connect to MySQL server on 'IP of the server' (10048) I am using .Net 2.0 with VS2005 having ODBC 3.51.14 Driver.  Can any body point out the core reasons of the above error message? Thanks. Nouman Khawaja. I do have the same problem, help me out. Thanks  If the going seems easy, You are going DownHill... When I was writing ...

Currently have a site coded in PHP but the customer wants to go to .NET. Can I use the existing MySQL DB or am I required to use MSSQL? Thanks, Ken Check out this forum which is specialized for this kind of questions: ASP.NET MySQL forumBart De Smet [MVP] Visit,

Membership provider for MySQL
I know this has been looked at and I am aware of the code projects membership provider.I have 2 questions.  Is that provider any good?? (not able to try it yet till I get my development pc back)Second is there a profile provider out there (any of you lovely coders got any up your sleaves!!)Just been on a 2.0 course and really want to use it, but we are unable to get sql 2005 at work, so need to get all the features I can on MySQLCheers :) Yes, Mysql is perfect database server. I'm wondering why you cannot use the SQL 2005!? You can use the FREE express edition   R...

Membership Provider mysql
is there a Membership Provider for mysql? if so where can I find it? fnx The Big Fing Hello.I don't know any...i think that you'll have to build your own.-- Regards,Luis Abreuemail: labreu_at_gmail.comEN blog:

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
Hi, I get the error when I try to connect.. :o(( What's wrong? TIA, Juan. ...

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.soc
2 day old install of 11.3; I installed MYSQL from yast2; 12 items relating to MYSQL are shown as installed; on a command line (as root) I get "ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.soc" when I type MYSQL. Another problem ; Apache is installed and running, but my install of PHP from Yast has been troubled, and very much unlike what I read here : "" ; a web page with phpinfo() shows nothing; do I have to do another manual config of LAMP ? If so wh...

Segmentation fault while connecting to mysql through DBD::Mysql
Hi All, When I try to connect to mysql db through perl dbd, get segmentation fault error. attached DBI trace report. Any help on this is appreciated. Name "main::dbwritesallowed" used only once: possible typo at ./ line 14. DBI 1.15-nothread dispatch trace level set to 5 -> DBI->connect(DBI:mysql:host=localhost;database=bugs;port=3306, bugs, ****) -> DBI->install_driver(mysql) for perl=5.008003 pid=2777 ruid=0 euid=0 install_driver: DBD::mysql loaded (version 2.9002) New DBI::dr (for DBD::mysql::dr, parent=, id=) dbih_...

Newbie: DBD::mysql error connecting to mysql
I'm new to Bugzilla, Apache, mysql, and perl (whew) and am trying to get Bugzilla 2.18 up and running... I've been banging my head on a problem for a few hours and seem to be stuck... I am at the point where runs cleanly. I can connect to the system from a browser on a client workstation and get the initial Bugzilla screen without errors. When I navigate to some of the other screens, such as "Enter a new bug report" I am faced with a "Software Error" that seems to indicate perl is having trouble connecting to mysql. Any help is appreciate...

RE: Newbie: DBD::mysql error connecting to mysql
Looks like your version of DBD::mysql is one version too old. You should upgrade. Try perl -MCPAN -e 'install "DBD::mysql"' -----Original Message----- From: Tom Firl [] Sent: Tuesday, February 22, 2005 2:00 PM To: Subject: Newbie: DBD::mysql error connecting to mysql I'm new to Bugzilla, Apache, mysql, and perl (whew) and am trying to get Bugzilla 2.18 up and running... I've been banging my head on a problem for a few hours and seem to be stuck... I am at the point where ...

MySQL membership provider help
Hi,I want to use MySQL as the data store for membership/roles info - this looks like a possible solution: can compile the provider with the MySQLConnector for 2.0 without any problems, but I can't get their SQL to create the necessary tables in MySQL 5.0. It fails at the ALTER TABLE line. Unfortunately the error I'm getting in MySQL Front only tells me that there's a syntax error and to check the manual.I'm just wondering if anyone else has tried using this provider and had the same problem creatin...

mysql php5-mysql
Hi, i have installed mysqk from binaries itworks!!! but now how can i install php5-mysql and dependencies? Many thanks Thierry -- trazomtg ------------------------------------------------------------------------ When you say from the binaries, do you mean you installed via Yast and the Suse repositories?? It is always best to install via Yast-Software-Software Management if you can. This way all dependencies are done for you. -- gogalthorp ------------------------------------------------------------------------ gogalthorp's Profile: http://forums.opensuse....

Use MySQL for a Membership Provider?
In case anyone else stumbles across this post, I just recently added an article on my blog that details how to implement ASP.NET Membership and Roles using MySQL 5.0.  You can view the article here:  Hope it helps someone. MarvinIf, by some rare and amazing chance, I suggested a solution that actually worked for you, please mark the post as "ANSWER" because, hey, I don't pull that off very often. ;-)...

Connecting to MySQL from VS.Net
I can connect to SQL server in VS.Net, but I cannot get to connect to my remote MySQL server. It would be great if I could use the same UI to admin the two server. Anyone know how I can do this ?...

membership provider for mysql usage
where can i find a membership provider implementation for using with mysql server ? thanx,    I suggest you have a look at - This article provides two files that contain a Membership Provider and a Role Provider for ASP.NET v2.0. - An article on implementing MySQL Providers for ASP.NET 2.0 Membership, Roles, Site Map and Personalization - .NET 2.0 Membership, Role and Profile providers for use with MyS...

Membership and Role providers for MySQL
I look for Membership and Role providers for MySQL thanks...

Web resources about - Mysql-ASP Membership Provider Connection -

The Church of Jesus Christ of Latter-day Saints membership statistics - Wikipedia, the free encyclopedia ...
Percentages of LDS members were calculated with this information. The link under the names of each country, territory, etc. corresponds to brief ...

Civility Caucus In Congress Turns To Facebook To Boost Membership
In the midst of a heated election season and record-low approval numbers for Congress, an under-the-radar congressional caucus focused on changing ...

Search Twitter - membership
... Bum @ prodigalbum 1m Nothing will consign Labour to oblivion faster than a backroom PLP coup to oust a leader chosen by the wider membership ...

Membership Has Its Privileges
Right now, crossing one of the magical rep borders happens more or less unnoticed. People just gain the particular powers. Now, of course they ...

Membership Cards - a set on Flickr
... home Sign Up Explore Recent Photos The Commons Getty Collection Galleries World Map App Garden Camera Finder Flickr Blog Upload Sign In Membership ...

Membership Sites Blueprint Review - The TRUTH Exposed! - YouTube
Membership Sites Blueprint review - My FREE $1000 a day training - Hey guys its ...

The benefits of private club membership in the UAE
Lifestyle membership clubs can offer cardholders exclusive leisure discounts across the Emirates. But there can be a big catch - you need to ...

Sheikh's previous ALP membership revealed
ACT Greens senate candidate Simon Sheikh has conceded he was previously a member of the Labor party before becoming a self-proclaimed independent ...

Joe Tripodi's ALP membership suspended
NSW ALP has suspended membership of Joe Tripodi amid a corruption inquiry.

Arboretum membership gets flexible
Membership options for the National Arboretum have been expanded to include general and family passes.

Resources last updated: 12/4/2015 5:33:47 AM