MembershipProviderCollection Class
.NET Framework 2.0
A collection of objects that inherit the MembershipProvider abstract class.
Namespace: System.Web.Security
Assembly: System.Web (in system.web.dll)
Assembly: System.Web (in system.web.dll)
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.
The following code example lists the providers enabled for an application and their respective types.
<%@ Page Language="C#" %> <%@ Import Namespace="System.Web.Security" %> <%@ Import Namespace="System.Configuration.Provider" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>List Enabled Providers</title> </head> <body> <% foreach (ProviderBase p in Membership.Providers) Response.Write(p.Name + ", " + p.GetType() + "<br />"); %> </body> </html>
- AspNetHostingPermission for operating in a hosted environment. Demand value: LinkDemand; Permission value: Minimal.
System.Object
System.Configuration.Provider.ProviderCollection
System.Web.Security.MembershipProviderCollection
System.Configuration.Provider.ProviderCollection
System.Web.Security.MembershipProviderCollection
Community Additions
ADD
Show: