Arşiv

Posts Tagged ‘visual web developer’

Asp.Net Authorization & Authentication with MySQL

Eylül 9, 2008 Hasan Gürsoy 4 yorum

I’ve been googling all day to find how to use the ASP.NET Login Controls with MySQL. I did it. I would share this knowledge here.

Firstly install Mysql.Data 5.2.2 (version 5.2.3 doesn’t auto generate schema). You can find it here.

Add connection string for your database connection:

<connectionStrings>
<remove name="LocalMySqlServer"/>
<add name="LocalMySqlServer" connectionString="server=localhost; user id=root; password=toor; persist security info=true; database=dorknozzle;" providerName="MySql.Data.MySqlClient"/>
</ connectionStrings>

Copy dll s Mysql.Data and Mysql.Web into your application’s Bin folder and refresh the Solution Explorer from Visual Studio.

Open machine.config file and add attribute autogenerateschema=”true” at this line:

<membership>
<providers>
<add name="MySQLMembershipProvider" autogenerateschema="true" type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=5.2.2.0, ... />
</providers>
</membership>

Open your ASP.Net Configuration site (With the web site project loaded in Visual Web
Developer, select Website > ASP.NET Configuration). Select MySQLMembershipProvider from Membership Provide’s list and MySQLRoleProvider from Role Provider at Provider Tab. You can also test them if there is connection.

I had these errors during the learning process :) :

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. (c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\machine.config line 145)

You could also see these pages. They get really helpfull for me:

www.dotnetsurfers.com
blog.nolanbailey.com
forums.asp.net