I'm using multiple role providers, the standard SQL provider plus a custom one. Inside Global.asax - RoleManager_GetRoles I create a RolePrincipal for users that should use my custom provider with the provider name set to my custom provider, and let other users be handled as normal.
This almost works, asp.net allows access to pages protected via the web.config and calls my provider to get the list of roles. However, when I call Roles.GetRolesForUser() inside my code it only seems to invoke the default role provider, not my custom provider. If I set my custom provider to be the default, then it is invoked, but only it is ever invoked.
I've worked around it by instead enumerating the role providers and calling GetRolesForUser() on the provider with a matching name to the RolePrincipal, but it seems to me that Roles.GetRolesForUser() should be doing that by default.
Am I missing something? Thanks.