CreateUserWizard::MembershipProvider Property

 

Gets or sets the membership provider called to create user accounts.

Namespace:   System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

public:
[ThemeableAttribute(false)]
property String^ MembershipProvider {
	virtual String^ get();
	virtual void set(String^ value);
}

Property Value

Type: System::String^

The MembershipProvider used to create user accounts. The default is Empty.

Exception Condition
HttpException

The specified membership provider is not defined in the Web.config file.

The MembershipProvider property contains the name of the defined MembershipProvider class membership provider that is used to store the user information. You can store membership information for users in different data stores by changing the value of the MembershipProvider property. When the MembershipProvider property is set to Empty, the default membership provider defined in the Web.config file is used.

Membership providers are defined in the Web.config file in the <membership> section.

This property cannot be set by themes or style sheet themes. For more information, see ThemeableAttribute and ASP.NET Themes and Skins.

The following code example requires membership providers defined in the <membership> section of the Web.config file. The following is a Web.config file that defines membership providers for each division in a small company. For this example, each membership provider points to a SQL Server database.

<configuration>

<system.web>

<membership>

<providers>

<add name="accountingProvider"

type="System.Web.Security.SqlMembershipProvider,

System.Web, Version=2.0.3600.0, Culture=neutral,

PublicKeyToken=b03f5f7f11d50a3a"

connectionStringName="LocalSqlServer"

enablePasswordRetrieval="false"

enablePasswordReset="true"

requiresQuestionAndAnswer="false"

applicationName="/"

requiresUniqueEmail="false"

passwordFormat="Hashed"

description="Stores and retrieves membership data from a Microsoft SQL Server database."

/>

<add name="manufacturingProvider"

type="System.Web.Security.SqlMembershipProvider,

System.Web, Version=2.0.3600.0, Culture=neutral,

PublicKeyToken=b03f5f7f11d50a3a"

connectionStringName="LocalSqlServer"

enablePasswordRetrieval="false"

enablePasswordReset="true"

requiresQuestionAndAnswer="false"

applicationName="/"

requiresUniqueEmail="false"

passwordFormat="Hashed"

description="Stores and retrieves membership data from a Microsoft SQL Server database."

/>

<add name="marketingProvider"

type="System.Web.Security.SqlMembershipProvider,

System.Web, Version=2.0.3600.0, Culture=neutral,

PublicKeyToken=b03f5f7f11d50a3a"

connectionStringName="LocalSqlServer"

enablePasswordRetrieval="false"

enablePasswordReset="true"

requiresQuestionAndAnswer="false"

applicationName="/"

requiresUniqueEmail="false"

passwordFormat="Hashed"

description="Stores and retrieves membership data from a Microsoft SQL Server database."

/>

<add name="salesProvider"

type="System.Web.Security.SqlMembershipProvider,

System.Web, Version=2.0.3600.0, Culture=neutral,

PublicKeyToken=b03f5f7f11d50a3a"

connectionStringName="LocalSqlServer"

enablePasswordRetrieval="false"

enablePasswordReset="true"

requiresQuestionAndAnswer="false"

applicationName="/"

requiresUniqueEmail="false"

passwordFormat="Hashed"

description="Stores and retrieves membership data from a Microsoft SQL Server database."

/>

</providers>

</membership>

</system.web>

</configuration>

The following code example inserts a step before the user account is created to determine which division of an organization the user belongs to. It then sets the MembershipProvider provider to the appropriate provider for that division.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show: