Usage Quick start

The following guide shows how to get up and running with BetterMembership.Net as quickly as possible.


The library can be installed via Nuget as follows:

PM> Install-Package BetterMembership.Net


The providers are configured within the web.config in the usual way. Note BetterRoleProvider and BetterProfileProvider require a membershipProviderName attribute. This is used to reference an instance of the BetterMembershipProvider instance from which they will inherit the relevant settings, such as connection string and schema configuration.

<membership defaultProvider="BetterProvider">
    <add name="BetterProvider" type="BetterMembership.Web.BetterMembershipProvider, BetterMembership, Version=, Culture=neutral, PublicKeyToken=737bc70442f2c4af" connectionStringName="DefaultConnection" autoInitialize="true" />
<roleManager defaultProvider="BetterProvider" enabled="true">
    <add name="BetterProvider" type="BetterMembership.Web.BetterRoleProvider, BetterMembership, Version=, Culture=neutral, PublicKeyToken=737bc70442f2c4af" membershipProviderName="BetterProvider" />
<profile defaultProvider="BetterProvider" enabled="true">
    <add name="BetterProvider" type="BetterMembership.Web.BetterProfileProvider, BetterMembership, Version=, Culture=neutral, PublicKeyToken=737bc70442f2c4af" membershipProviderName="BetterProvider" />


The providers can be initialized in one of 2 ways. Either automatically by setting the autoInitialize attribute to true, or alternatively by a call to WebSecurity.InitializeDatabaseConnection once on application startup. Support for non-default providers is only possible when using autoInitialize=true.

Regardless of how the provider is initialized, the provider must be configured via the web.config with the correct userIdColumn, userNameColumn, and userTableName attributes. When using WebSecurity.InitializeDatabaseConnection for initialization, these values must correspond to the values passed to the API call.