Bug #40871 Cannot name the MySQLProfileProvider with a non-default name
Submitted: 19 Nov 2008 22:24 Modified: 9 Dec 2008 16:34
Reporter: Mauricio Morales Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:5.2.5 OS:Windows (XP)
Assigned to: CPU Architecture:Any

[19 Nov 2008 22:24] Mauricio Morales
Description:
When configuring the MySql.Web.Profile.MySQLProfileProvider, you cannot give it a different name than the default name 'MySQLProfileProvider'.

I tried with SCC_MySQLProfileProvider, and failes when trying to use the Page.Context.Profile['custom prop'] feature. The exception raised stated: 'The profile default provider was not found'. 
Note that the exception reads: 'the profile DEFAULT PROVIDER...', when I explicitly requested my provider to be named differently.

Here's the Web.config snippet:
    <profile enabled="true"
             defaultProvider="MySQLProfileProvider"
             automaticSaveEnabled="true">
      <providers>
        <clear />
        <add name="MySQLProfileProvider"
             type="MySql.Web.Profile.MySQLProfileProvider, MySql.Web, Version=5.2.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"
             connectionStringName="DBConnectionString"
             applicationName="/SCC"
             autogenerateschema="true" />
      </providers>
      <properties>
        <add name="Site" 
             type="System.String" 
             allowAnonymous="false" />
      </properties>
    </profile>

How to repeat:
Change the provider name in the Web.config to something different than 'MySQLProfileProvider'.

<profile enabled="true"
             defaultProvider="SCC_MySQLProfileProvider"
             automaticSaveEnabled="true">
      <providers>
        <clear />
        <add name="SCC_MySQLProfileProvider"
             type="MySql.Web.Profile.MySQLProfileProvider, MySql.Web, Version=5.2.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"
             connectionStringName="DBConnectionString"
             applicationName="/SCC"
             autogenerateschema="true" />
      </providers>
      <properties>
        <add name="Site" 
             type="System.String" 
             allowAnonymous="false" />
      </properties>
    </profile>

Suggested fix:
This might be a useful link:
http://wildermuth.com/2006/11/30/Sample_Code_for_Custom_ASP_NET_Profile_Provider

In the end, the error was overriding the Name property of the provider to something different than what's configured in the Web.config file.
[3 Dec 2008 20:35] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/60547
[3 Dec 2008 20:35] Reggie Burnett
Fixed in 5.2.6+
[9 Dec 2008 16:34] Tony Bedford
An entry was added to the 5.2.6 changelog:

When MySql.Web.Profile.MySQLProfileProvider was configured, it was not possible to assign a name other than the default name MySQLProfileProvider.

If the name SCC_MySQLProfileProvider was assigned, an exception was generated when attempting to use Page.Context.Profile['custom prop'].

The exception generated was:

The profile default provider was not found.
Note that the exception stated: 'the profile default provider...', even though a different name was explicitly requested.