简体   繁体   中英

Choosing a role provider - ASP.net membership provider

I'm using 2 membership providers on my Umbraco CMS. 1 provider is used for CMS users and the other is to be used for site membership.

I have 2 role providers too - UmbracoRoleProvider & AspNetSqlRoleProvider. How do I access each one in the code? eg when a new user registers, I'd like to add a role for them as "member", but it defaults to the Umbraco role provider because that is the default.

I thought I'd be able to do something like this:

Roles.AddUserToRole(EmailAddress.Text, "Member", "AspNetSqlRoleProvider");

Or something similar, but can't find any info on it. Can it be done over a few lines of code, or is it more complex than that?

Thanks

Using multiple role providers is not supported out of the box. You could use the Composite pattern to implement your own role provider that checks both for valid roles and memberships, but I would try to find a way to use a single role provider instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM