MembershipProviderCollection.Item[String] Property

Definition

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

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

Parameters

name
String

The name of the membership provider.

Property Value

An object that inherits the MembershipProvider abstract class.

Examples

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

SqlMembershipProvider p = (SqlMembershipProvider)Membership.Providers["SqlProvider"];
PasswordFormatLabel.Text = p.PasswordFormat.ToString();
Dim p As SqlMembershipProvider = CType(Membership.Providers("SqlProvider"), SqlMembershipProvider)
PasswordFormatLabel.Text = p.PasswordFormat.ToString()

Remarks

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

Applies to

See also