O'Reilly logo

Professional ASP.NET 3.5 Security, Membership, and Role Management with C# and VB by Stefan Schackow, Bilal Haidar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

11.3. The MembershipProvider Base Class

The central part of the Membership feature is its use of providers that derive from System.Web.Security.MembershipProvider. Out of the box, the Framework ships with two implementations of this class: SqlMembershipProvider and ActiveDirectoryMembershipProvider. Both of these providers are discussed in more detail in succeeding chapters. Because the Membership feature allows you to configure any type of provider, you can also write your own custom implementations of this class.

The base class definition that all providers must adhere to is shown below. The class definition falls into three major areas: abstract properties, abstract and protected methods, and a small number of event-related definitions.

C#

public abstract class MembershipProvider : ProviderBase
{
    //Properties
    public abstract bool EnablePasswordRetrieval { get; }
    public abstract bool EnablePasswordReset { get; }
    public abstract bool RequiresQuestionAndAnswer { get; }
    public abstract string ApplicationName { get; set; }
    public abstract int MaxInvalidPasswordAttempts { get; }
    public abstract int PasswordAttemptWindow { get; }
    public abstract bool RequiresUniqueEmail { get; }
    public abstract MembershipPasswordFormat PasswordFormat { get; }
    public abstract int MinRequiredPasswordLength { get; }
    public abstract int MinRequiredNonAlphanumericCharacters { get; }
    public abstract string PasswordStrengthRegularExpression { get; }

    //Public Methods public abstract MembershipUser CreateUser( ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required