Επεξεργασία

Κοινή χρήση μέσω


RoleProviderCollection.Item[String] Property

Definition

Gets the role provider in the collection referenced by the specified provider name.

public:
 property System::Web::Security::RoleProvider ^ default[System::String ^] { System::Web::Security::RoleProvider ^ get(System::String ^ name); };
public System.Web.Security.RoleProvider this[string name] { get; }
member this.Item(string) : System.Web.Security.RoleProvider
Default Public ReadOnly Property Item(name As String) As RoleProvider

Parameters

name
String

The name of the role provider.

Property Value

An object that inherits the RoleProvider abstract class.

Examples

The following code example accesses a SqlRoleProvider configured for an application from the Providers property of the Roles class by name.

SqlRoleProvider p = (SqlRoleProvider)Roles.Providers["SqlProvider"];
DescriptionLabel.Text = p.Description;
Dim p As SqlRoleProvider = CType(Roles.Providers("SqlProvider"), SqlRoleProvider)
DescriptionLabel.Text = p.Description

Remarks

The role providers for an application are exposed as a read-only RoleProviderCollection by the Providers property of the Roles class. You can access a specific role provider in the collection by name and cast it as the specific provider type, such as SqlRoleProvider. This enables you to manage role information from multiple data stores in a single application as well as access custom members of a role provider that are not part of the RoleProvider abstract class.

Applies to

See also