4.12 MySQL Website Configuration Tool

This MySQL for Visual Studio feature enables you to configure the Membership, Role, Site Map, Personalization, Session State, and Profile Provider options without editing the configuration files. You set your configuration options within the tool, and the tool modifies your web.config file accordingly.

Note

Site Map and Personalization provider support requires Connector/Net 6.9.2 or later, and MySQL for Visual Studio 1.2.1 or later.

The MySQL Website Configuration Tool appears as a small icon on the Solution Explorer toolbar in Visual Studio, as show by the following screenshot:

Figure 4.30 MySQL Website Configuration Tool

MySQL Website Configuration Tool

Note

The MySQL Website Configuration Tool icon is only visible if a MySQL project is active.

Clicking the Website Configuration Tool icon launches the wizard and displays the first screen:

Figure 4.31 MySQL Website Configuration Tool - Membership

MySQL Website Configuration Tool - Membership

This allows you to enable a MySQL Membership Provider. In addition to the standard (advanced) "Membership" provider, there is also a "Simple Membership" provider. You can only choose one of these two membership providers.

Advanced Membership Provider

To use the more advanced "Membership" provider, select the "Use MySQL to manage my membership records check box to enable this. You can now enter the name of the application that you are creating the configuration for. You can also enter a description for the application.

You can then click the Edit... button to launch the Connection String Editor:

Figure 4.32 MySQL Website Configuration Tool - Connection String Editor

MySQL Website Configuration Tool - Connection String Editor

Note that if you have already defined a connection string for the providers manually in web.config, or previously using the tool, this will be automatically loaded and displayed, and can then be modified in this dialog.

You can also ensure that the necessary schemas are created automatically for you by selecting the Autogenerate Schema check box. These schemas are used to store membership information. The database used to storage is the one specified in the connection string.

You can also ensure that exceptions generated by the application will be written to the Windows event log by selecting the Write exceptions to event log check box.

Clicking the Advanced... button launches a dialog that enables you to set Membership Options. These options dictate such variables as password length required when a user signs up, whether the password is encrypted and whether the user can reset their password or not.

Figure 4.33 MySQL Website Configuration Tool - Advanced Options

MySQL Website Configuration Tool - Advanced Options

Simple Membership Provider

The "Simple Membership" provider is similar to the advanced version, but it includes less options. To enable, check the "Use MySQL to manage my simple membership records" check box.

Note

The "Simple Membership" option was added in MySQL for Visual Studio version 1.2.3.

Figure 4.34 MySQL Website Configuration Tool - Simple Membership

MySQL Website Configuration Tool - Simple Membership

The MySQL Simple Membership provider handles the web site membership tasks with ASP.NET. This provider is a simpler version of the ASP.NET Membership provider, and it can also work with OAuth Authentication. For additional information about using OAuth authentication, see Section 5.6.3, “Adding OAuth Authentication to a Project”.

The required configuration options for the Simple Membership provider are: a name for the connection string, and a connection string that contains a valid database with a local or remote MySQL server instance, a user table to store the credentials, and column names for the User ID and User Name columns.

Check the Auto Create Tables option to create the required tables when adding the first user to the table.

After setting up a membership provider, a new section is added to the web configuration file.

Figure 4.35 MySQL Website Configuration Tool - Simple Membership Entry

MySQL Website Configuration Tool - Simple Membership Entry

After setting up one of the membership providers, click Next to configure the Roles Provider:

Figure 4.36 MySQL Website Configuration Tool - Roles

MySQL Website Configuration Tool - Roles

Again the connection string can be edited, a description added and Autogenerate Schema can be enabled before clicking Next to go to the Profiles Provider screen:

Figure 4.37 MySQL Website Configuration Tool - Profiles

MySQL Website Configuration Tool - Profiles

This screen display similar options to the previous screens.

Click Next to proceed to the Session State configuration page:

Figure 4.38 MySQL Website Configuration Tool - Session State

MySQL Website Configuration Tool - Session State

Click Next to proceed to the Site Map configuration page:

Figure 4.39 MySQL Website Configuration Tool - Site Map

MySQL Website Configuration Tool - Site Map

The Site Map provider builds a site map from a MySQL database, and builds a complete tree of the SitemapNode objects. It also provides methods so that the generated nodes can be read from the site map.

The required configuration options: A name for the connection string, and a connection string that contains a valid database with a local or remote MySQL server instance.

After setting up the Site Map provider, a new section is added to the web configuration file.

Figure 4.40 MySQL Website Configuration Tool - Site Map, Configuration Entry

MySQL Website Configuration Tool - Site Map, Configuration Entry

Click Next to proceed to the Web Personalization configuration page:

Figure 4.41 MySQL Website Configuration Tool - Web Personalization

MySQL Website Configuration Tool - Web Personalization

The Web Personalization provider is used when a Web Site application needs to store persistent information for the content and layout of the Web Parts pages that are generated by a Web Parts personalization service. This provider should be used along with the Membership, Roles, and Profiles providers.

The required configuration options: A name for the connection string, and a connection string that contains a valid database with a local or remote MySQL server instance.

After setting up the Personalization provider, a new section is added to the web configuration file.

Figure 4.42 MySQL Website Configuration Tool - Web Personalization, Configuration Entry

MySQL Website Configuration Tool - Web Personalization, Configuration Entry

Once you have set up the optional Web Personalization options, click Finish to exit the wizard.

At this point, select the Authentication Type to From Internet. Launch the WEBSITE, ASP.NET Configuration tool and select the Security tab. Click the Select authentication type link and ensure that the From the internet radio button is selected. You can now examine the database you created to store membership information. All the necessary tables will have been created for you:

Figure 4.43 MySQL Website Configuration Tool - Tables

MySQL Website Configuration Tool - Tables

For users of Visual Studio 2010 and earlier who want to perform the configuration by editing the web.config file manually (recommended only for advanced users), the following pages provide some useful info: