Get specific membership provider

血红的双手。 提交于 2019-12-22 04:32:27

问题


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?


回答1:


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

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


来源:https://stackoverflow.com/questions/6707529/get-specific-membership-provider

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!