RoleProviderCollection.Item[String] Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈