RolePrincipal.ProviderName 属性

定义

获取存储和检索用户角色信息的角色提供程序的名称。Gets the name of the role provider that stores and retrieves role information for the user.

public:
 property System::String ^ ProviderName { System::String ^ get(); };
public string ProviderName { get; }
member this.ProviderName : string
Public ReadOnly Property ProviderName As String

属性值

String

存储和检索用户角色信息的角色提供程序的名称。The name of the role provider that stores and retrieves role information for the user.

注解

ProviderName属性公开角色提供程序的名称,该提供程序管理对象表示的用户的角色信息 RolePrincipalThe ProviderName property exposes the name of the role provider that manages the role information for the user represented by the RolePrincipal object. 这使你可以通过使用类的属性访问用户的特定角色提供程序实例, Providers Roles 而不管提供程序是否是应用程序的默认提供程序。This enables you to access the specific role-provider instance for a user by using the Providers property of the Roles class regardless of whether the provider is the default provider for the application. 例如,你可以创建一个采用作为输入的方法, RolePrincipal 并返回所表示用户的角色列表。For example, you may create a method that takes a RolePrincipal as input and returns the list of roles for the represented user. 可以 RolePrincipal 通过 GetRolesForUserProviders 属性值编制索引的集合中调用角色提供程序的方法,确保使用适当的角色提供程序返回的角色的列表 ProviderNameYou can ensure that the appropriate role provider is used to return the list of roles for the RolePrincipal by calling the GetRolesForUser method of the role provider from the Providers collection that is indexed by the ProviderName property value.

若要填充 RolePrincipal 每个请求的对象,必须使用 GetRoles 应用程序的 global.asax 文件中定义的事件处理程序。To populate the RolePrincipal object for each request, you must use a GetRoles event handler defined in the Global.asax file for the application.

适用于