Bug #45337 Error when creating role using ASP.NET Web Site Administration Tool
Submitted: 4 Jun 2009 17:33 Modified: 10 Jun 2009 20:38
Reporter: Ranv Z Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / NET Severity:S1 (Critical)
Version:6.0.3 OS:Windows (Windows XP Proffesional Service Pack 2)
Assigned to: CPU Architecture:Any
Tags: asp.net, membership, object reference, provider, role

[4 Jun 2009 17:33] Ranv Z
Description:
I want to use the MySQL .NET Connector so that I can use the database with Membership and Role providers.  The connector supports this technology and I have most of it working.  I can make new users using the ASP.NET Web Site Administration Tool in Visual Studio.  However, when I create a role and then click on the "Manage" link.  I get this error:

Object reference not set to an instance of an object. at System.Web.Administration.WebAdminPage.CallWebAdminHelperMethod(Boolean isMembership, String methodName, Object[] parameters, Type[] paramTypes) at ASP.security_roles_managesinglerole_aspx.Page_Load() at System.Web.Util.CalliHelper.ArglessFunctionCaller(IntPtr fp, Object o) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

What's strange is that, when I look at the contents of the `my_aspnet_role` table in the provider database schema, it contains the role I created.  Unfortunately though, the ASP.NET admin tool doesn't think the roles are there so I can't assign users to roles.

My enviornment Information:
Windows XP Proffessional
Visual Studio 2005 Proffessional Edition
ASP.NET 2.0.50727
MySQL Server 5.0.67
MySQL Connector Net 6.0.3

My web.config Information:
(The user name and password in the connection string are not shown for security reasons. Also, I am running the MySQL Server on port 3307 and not the default port of 3306.)

<connectionStrings>
	<remove name="LocalMySqlServer"/>
	<add name="LocalMySqlServer" connectionString="DataSource=localhost;Port=3307;Database=DB;uid=;pwd=;" providerName="MySql.Data.MySqlClient"/>
</connectionStrings>

<system.web>
	<roleManager enabled="true" defaultProvider="MySQLRoleProvider">
		<providers>
			<clear />
			<add name="MySQLRoleProvider" type="MySql.Web.Security.MySQLRoleProvider, MySql.Web, Version=6.0.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/" />
	      </providers>
	    </roleManager>

		<membership defaultProvider="MySQLMembershipProvider">
			<providers>
			<clear/>
			<add autogenerateschema="true" name="MySQLMembershipProvider" type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.0.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" />
		</providers>
	</membership>
</system.web>

How to repeat:
1.  Install MySQL Connector/NET Version 6.0.3.
2.  Create a new ASP.NET Website in Visual Studio 2005.
3.  In Visual Studio 2005, go to the menu "Website" and select "ASP.Net Configuration".  (I am assuming that you already have the Provider schema database created).
4.  Click on the "Provider" tab and then select the MySQLMembershipProvider and the MySQLRoleProvider.
5.  Click on the "Security" tab.
6.  Click on the "Create or Manager roles" link.
7.  Create the role and then click on the "Manage" link.  You should get the error.

Suggested fix:
Fix the error that occurs when creating a role.
[9 Jun 2009 15:49] Tonci Grgin
Hi Ranv and thanks for your report. I think this is a duplicate, let me search for you...
[9 Jun 2009 15:55] Tonci Grgin
This is probably a duplicate of Bug#44414 which is already fixed in trunk.
[10 Jun 2009 20:38] Ranv Z
Yes, it was a duplicate.  My apologies, I should have searched the bug database before posting this.

Anyhow, I installed MySQL Connector .NET 5.2.5 which fixes the problem so I'll use that (until MySQL Connector .NET 6.0.4 comes out).

Thanks for your help Tonci!