Oracle 5.0 Reference Manual page 1885

Table of Contents

Advertisement

rdr.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
conn.Close();
Console.WriteLine("Done.");
}
}
In this section, you have seen how to call a stored procedure from Connector/Net. For the moment, this
concludes our introductory tutorial on programming with Connector/Net.
20.2.4.2. Tutorial: MySQL Connector/Net ASP.NET Membership and Role Provider
Many web sites feature the facility for the user to create a user account. They can then log into the
web site and enjoy a personalized experience. This requires that the developer creates database
tables to store user information, along with code to gather and process this data. This represents a
burden on the developer, and there is the possibility for security issues to creep into the developed
code. However, ASP.NET 2.0 introduced the Membership system. This system is designed around
the concept of Membership, Profile and Role Providers, which together provide all of the functionality
to implement a user system, that previously would have to have been created by the developer from
scratch.
Currently, MySQL Connector/Net provides Membership, Role, Profile and Session State Providers.
This tutorial shows you how to set up your ASP.NET web application to use the MySQL Connector/Net
Membership and Role Providers. It assumes that you have MySQL Server installed, along with MySQL
Connector/Net and Microsoft Visual Studio. This tutorial was tested with MySQL Connector/Net 6.0.4
and Microsoft Visual Studio 2008 Professional Edition. It is recommended you use 6.0.4 or above for
this tutorial.
1. Create a new database in the MySQL Server using the MySQL Command-Line Client program
(mysql), or other suitable tool. It does not matter what name is used for the database, but record it.
You specify it in the connection string constructed later in this tutorial. This database contains the
tables, automatically created for you later, used to store data about users and roles.
2. Create a new ASP.NET Web Site in Visual Studio. If you are not sure how to do this, refer to
Section 20.2.4.6, "Tutorial: Databinding in ASP.NET using LINQ on
how to create a simple ASP.NET web site.
3. Add References to
4. Locate the
Framework.
5. Search the
6. Add the attribute autogenerateschema="true". The appropriate section should now resemble
the following (note: for the sake of brevity some information has been excluded):
<membership>
<providers>
<add name="AspNetSqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider"
...
connectionStringName="LocalSqlServer"
... />
<add name="MySQLMembershipProvider"
autogenerateschema="true"
type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.0.4.0, Culture=neutral,
connectionStringName="LocalMySqlServer"
... />
</providers>
Connector/Net Tutorials
and
MySql.Data
file on your system, which is the configuration file for the .NET
machine.config
file to find the membership provider MySQLMembershipProvider.
machine.config
to the web site project.
MySql.Web
1865
Entities", which demonstrates

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents