Greg B
Greg B

Reputation: 14888

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?

Upvotes: 9

Views: 1882

Answers (1)

Greg
Greg

Reputation: 16680

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

MembershipProvider membershipProvider = Membership.Providers["foo"];

Upvotes: 11

Related Questions