How to get all users in a specific role?

☆樱花仙子☆ 提交于 2019-12-05 06:24:51

You need to use the Roles class defined in System.Web.Security. It has a Roles.GetUsersInRole method.

Here is the documentation.

If you want to map the returned username to a MembershipUser you can use Membership.GetUser(string username) method on each of the returned values.

Richard

Roles are handled by the role provider not the membership provider (for separation of authorisation from authentication).

So

string[] RoleProvider.GetUsersInRole(roleName)

(msdn).

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