Bug #45153 MySQL Connector/Net needs to be in the GAC for Roles.AddUserToRole
Submitted: 28 May 13:34 Modified: 20 Jun 10:37
Reporter: James Gurung
Status: Verified
Category:Connector/Net Severity:S3 (Non-critical)
Version:6.0.3 OS:Any
Assigned to: Reggie Burnett Target Version:
Tags: gac, roles, addusertorole, trust
Triage: D3 (Medium)

[28 May 13:34] James Gurung
Description:
Calling Roles.AddUserToRole in ASP.NET 3.5 with a MySQL 5 membership database throws the
following exception:

Description: The application attempted to perform an operation not allowed by the
security policy.  To grant this application the required permission please contact your
system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request failed.

Stack trace:
[SecurityException: Request failed.]
   MySql.Data.MySqlClient.MySqlConnection.EnlistTransaction(Transaction transaction) +0
   MySql.Data.MySqlClient.MySqlConnection.Open() +554
   MySql.Web.Security.MySQLRoleProvider.RemoveUsersFromRoles(String[] usernames, String[]
rolenames) +245
   System.Web.Security.Roles.RemoveUserFromRole(String username, String roleName) +191
   _default.Page_Load(Object sender, EventArgs e) in ...

The only current workaround is to give the connector full trust or put it in the GAC.

How to repeat:
Roles.AddUserToRole("testuser","testrole");
[28 May 13:38] Tonci Grgin
Hi James and thanks for your report.

I'm a bit puzzled with "The only current workaround is to give the connector full trust
or put it in the GAC.". It appears to me there should be no other way than this...
Also, I think this particular problem is already reported so I'll have to check BugsDB
before proceeding.
[7 Jul 8:25] Tonci Grgin
Possible duplicate in Bug#45980.
[7 Jul 12:05] Tonci Grgin
Bug#45980 was marked as duplicate of this report. Reggie, please take it in consideration
when fixing this.
[16 Oct 19:24] Marco Cianciaruso
any news about this problem?
[12 Nov 12:15] Marco Cianciaruso
Is this bug stil in version 6.1.2 ?? I continue to have the same exception