Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get specific membership provider

Is there a way to obtain a specific membership provider?

When you make calls to the static Membership methods they query whatever provider you have configured as the defaultProvider. Is it possible to get a reference to a specific provider that is configured in your web.config and query against only that provider?

like image 361
Greg B Avatar asked Jul 15 '11 13:07

Greg B


1 Answers

Yes, if you have multiple providers configured in your web.config, you can look them up by name.

MembershipProvider membershipProvider = Membership.Providers["foo"];
like image 102
Greg Avatar answered Sep 29 '22 11:09

Greg