Oracle 5.0 Reference Manual page 1892

Table of Contents

Advertisement

20.2.4.4. Tutorial: MySQL Connector/Net ASP.NET Profile Provider
This tutorial shows you how to use the MySQL Profile Provider to store user profile information in a
MySQL database. The tutorial uses MySQL Connector/Net 6.1.1, MySQL Server 5.1 and Microsoft
Visual Studio 2008 Professional Edition.
Many modern web sites allow the user to create a personal profile. This requires a significant amount
of code, but ASP.NET reduces this considerable by including the functionality in its Profile classes. The
Profile Provider provides an abstraction between these classes and a data source. The MySQL Profile
Provider enables profile data to be stored in a MySQL database. This enables the profile properties
to be written to a persistent store, and be retrieved when required. The Profile Provider also enables
profile data to be managed effectively, for example it enables profiles that have not been accessed
since a specific date to be deleted.
The following steps show you how you can select the MySQL Profile Provider.
1. Create a new ASP.NET web project.
2. Select the MySQL Website Configuration tool. Due to a bug in 6.1.1 you may have to first connect
to a server in Server Explorer before the tool's icon will display in the toolbar of the Solution
Explorer.
3. In the MySQL Website Configuration tool navigate through the tool to the Profiles page.
4. Select the Use MySQL to manage my profiles check box.
5. Select the Autogenerate Schema check box.
6. Click the Edit... button and configure a connection string for the database that will be used to store
user profile information.
7. Navigate to the last page of the tool and click Finish to save your changes and exit the tool.
At this point you are now ready to start using the MySQL Profile Provider. With the following steps you
can carry out a preliminary test of your installation.
1. Open your
2. Add a simple profile such as the following:
<system.web>
<anonymousIdentification enabled="true"/>
<profile defaultProvider="MySQLProfileProvider">
...
<properties>
<add name="Name" allowAnonymous="true"/>
<add name="Age" allowAnonymous="true" type="System.UInt16"/>
<group name="UI">
</group>
</properties>
</profile>
...
Note that
been authenticated to use profiles. They are identified by a GUID in a cookie rather than by user
name.
Now that the simple profile has been defined in web.config, the next step is to write some code to
test the profile.
1. In Design View design a simple page with the following controls:
Connector/Net Tutorials
file.
web.config
<add name="Color" allowAnonymous="true" defaultValue="Blue"/>
<add name="Style" allowAnonymous="true" defaultValue="Plain"/>
anonymousIdentification
has been set to true. This enables users who have not
1872

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents