Solved

MySQL ASP.Net Membership Provider

Posted on 2009-04-13
4
1,117 Views
Last Modified: 2012-05-06
I am trying to implement the Membership provider in ASP.Net and not having an easy time going about this. There are several tutorials I have followed in detail however I must be missing something.

Both of the Following Tutorials are to my understanding using the same technique in modifying the Machine.Config file to get ASP.net's Dev Server Config Tool to be able to see the MySql Connector.

Heres my checklist
1.) I am programming in asp/Vb.Net VS2005
2.) I uninstalled my latest copy of DotNet Connector and installed the 5.2.2.0 as requested in the tutorial.
3.) I have copied the requested DLL's(Mysql.web.dll and mysql.data.dll) into a Bin folder within my webapps directory.
4.) I have added a Connection string in my Web.Config File as follows
***See Code Section (Web.Config)
5.) I have changed the authentication mode to "Forms"
6.) I have modified my Machine.config
***See Code Section (Machine.Config)

The Problem i am getting is when I open the 'Asp.net Configuration Tool' and click on the 'Security' tab I get the following error. ***"There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store. The following message may help in diagnosing the problem. Unable to initialize provider. Missing or incorrect schema.

I am unsure where to go from here. I am quite new to ASP.net although i've been a console programmer for a number of years. I have never used the membership provider and wanted to learn about it, however at my company we exclusively use MySQL.

Any suggestions or help will be greatly appreciated it. I've spent the last week trying to get this implemented and I'm about ready to give up and just do roles management without using these nice controls provided out of the box by Visual Studio.

Referenced Tutorials
http://xspgroup.wordpress.com/2008/09/09/aspnet-authorization-authentication-with-mysql/
http://www.codeproject.com/KB/database/mysqlmembershipprovider.aspx
-Web.Config
<connectionStrings>
    <remove name="LocalMySqlServer"/>
    <add name="LocalMySqlServer" connectionString="Server=MyIP; Database=POSUtil; Uid=root; Pwd=MyPW;" providerName="MySql.Data.SqlClient" />
  </connectionStrings>
 
-Machine.Config
  <system.web>
    <processModel autoConfig="true" />
    <httpHandlers />
    <membership defaultProvider="MySqlMembershipProvider">
      <providers>
        <clear/>
        <remove name="MySqlMembershipProvider"/>
        <add name="MySQLMembershipProvider" autogenerateschema="true" type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=5.2.2.0, 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="" />
      </providers>
    </membership>
    <profile>
      <providers>
        <add name="MySQLProfileProvider" type="MySql.Web.Profile.MySQLProfileProvider, MySql.Web, Version=5.2.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/" />
      </providers>
    </profile>
    <roleManager defaultProvider="MySqlRoleProvider" enabled="true" cacheRolesInCookie="true" cookieName=".ASPROLES" cookieTimeout="30" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="All" >
      <providers>
        <clear />
        <add name="MySQLRoleProvider" type="MySql.Web.Security.MySQLRoleProvider,MySql.Web, Version=5.2.2.0, Culture=neutral,PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/" writeExceptionsToEventLog="false" />
      </providers>
    </roleManager>
  </system.web>

Open in new window

0
Comment
Question by:tk6077
  • 2
4 Comments
 
LVL 15

Expert Comment

by:deepaknet
ID: 24135976
There is a good wrapper here http://www.codeproject.com/KB/database/mysqlmembershipprovider.aspx

Can you check out?
0
 

Author Comment

by:tk6077
ID: 24137778
Unfortunately I've had no luck getting this class set to work. Its the second link I've provided in my referenced tutorials section. I understand the concept in this tutorial however it doesn't work for me. I am using MySQL v.4 which the author of that tutorial stated has problems loading the schema. So I have set up my own tables in accordance with the format layed out in the SQL statements to no avail.
0
 

Accepted Solution

by:
tk6077 earned 0 total points
ID: 24185568
I gave up trying to get the built in DotNet controls to work and just made my own. It would be nice to use them I just don't have the kind of time required to keep messing with it.
0
 

Expert Comment

by:manitou2215
ID: 26180369
If you ever have time to research this again, the following video series / associated tutorials really helped get me started with asp.net membership:

www.asp.net/learn/security-videos/

0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Creating and Managing Databases with phpMyAdmin in cPanel.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question