Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1132
  • Last Modified:

MySQL ASP.Net Membership Provider

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
tk6077
Asked:
tk6077
  • 2
1 Solution
 
deepaknetCommented:
There is a good wrapper here http://www.codeproject.com/KB/database/mysqlmembershipprovider.aspx

Can you check out?
0
 
tk6077Author Commented:
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
 
tk6077Author Commented:
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
 
manitou2215Commented:
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

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now