Export (0) Print
Expand All
2 out of 2 rated this helpful - Rate this topic

MembershipProvider Class

Defines the contract that ASP.NET implements to provide membership services using custom membership providers.

Namespace:  System.Web.Security
Assembly:  System.Web.ApplicationServices (in System.Web.ApplicationServices.dll)
public abstract class MembershipProvider : ProviderBase

The MembershipProvider type exposes the following members.

  NameDescription
Protected methodMembershipProviderInitializes a new instance of the MembershipProvider class.
Top
  NameDescription
Public propertyApplicationNameThe name of the application using the custom membership provider.
Public propertyDescriptionGets a brief, friendly description suitable for display in administrative tools or other user interfaces (UIs). (Inherited from ProviderBase.)
Public propertyEnablePasswordResetIndicates whether the membership provider is configured to allow users to reset their passwords.
Public propertyEnablePasswordRetrievalIndicates whether the membership provider is configured to allow users to retrieve their passwords.
Public propertyMaxInvalidPasswordAttemptsGets the number of invalid password or password-answer attempts allowed before the membership user is locked out.
Public propertyMinRequiredNonAlphanumericCharactersGets the minimum number of special characters that must be present in a valid password.
Public propertyMinRequiredPasswordLengthGets the minimum length required for a password.
Public propertyNameGets the friendly name used to refer to the provider during configuration. (Inherited from ProviderBase.)
Public propertyPasswordAttemptWindowGets the number of minutes in which a maximum number of invalid password or password-answer attempts are allowed before the membership user is locked out.
Public propertyPasswordFormatGets a value indicating the format for storing passwords in the membership data store.
Public propertyPasswordStrengthRegularExpressionGets the regular expression used to evaluate a password.
Public propertyRequiresQuestionAndAnswerGets a value indicating whether the membership provider is configured to require the user to answer a password question for password reset and retrieval.
Public propertyRequiresUniqueEmailGets a value indicating whether the membership provider is configured to require a unique e-mail address for each user name.
Top
  NameDescription
Public methodChangePasswordProcesses a request to update the password for a membership user.
Public methodChangePasswordQuestionAndAnswerProcesses a request to update the password question and answer for a membership user.
Public methodCreateUserAdds a new membership user to the data source.
Protected methodDecryptPasswordDecrypts an encrypted password.
Public methodDeleteUserRemoves a user from the membership data source.
Protected methodEncryptPassword(Byte[])Encrypts a password.
Protected methodEncryptPassword(Byte[], MembershipPasswordCompatibilityMode)Encrypts the specified password using the specified password-compatibility mode.
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodFindUsersByEmailGets a collection of membership users where the e-mail address contains the specified e-mail address to match.
Public methodFindUsersByNameGets a collection of membership users where the user name contains the specified user name to match.
Public methodGetAllUsersGets a collection of all the users in the data source in pages of data.
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetNumberOfUsersOnlineGets the number of users currently accessing the application.
Public methodGetPasswordGets the password for the specified user name from the data source.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodGetUser(Object, Boolean)Gets user information from the data source based on the unique identifier for the membership user. Provides an option to update the last-activity date/time stamp for the user.
Public methodGetUser(String, Boolean)Gets information from the data source for a user. Provides an option to update the last-activity date/time stamp for the user.
Public methodGetUserNameByEmailGets the user name associated with the specified e-mail address.
Public methodInitializeInitializes the provider. (Inherited from ProviderBase.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Protected methodOnValidatingPasswordRaises the ValidatingPassword event if an event handler has been defined.
Public methodResetPasswordResets a user's password to a new, automatically generated password.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Public methodUnlockUserClears a lock so that the membership user can be validated.
Public methodUpdateUserUpdates information about a user in the data source.
Public methodValidateUserVerifies that the specified user name and password exist in the data source.
Top
  NameDescription
Public eventValidatingPasswordOccurs when a user is created, a password is changed, or a password is reset.
Top

ASP.NET membership is designed to enable you to easily use a number of different membership providers for your ASP.NET applications. You can use the supplied membership providers that are included with the .NET Framework, or you can implement your own provider.

NoteNote

If you are not familiar with the membership features of ASP.NET, see Introduction to Membership before continuing. For a list of other topics related to membership, see Managing Users by Using Membership.

When implementing a custom membership provider, you are required to inherit the MembershipProvider abstract class.

There are two primary reasons for creating a custom membership provider.

  • You need to store membership information in a data source that is not supported by the membership providers included with the .NET Framework, such as a FoxPro database, an Oracle database, or other data source.

  • You need to manage membership information using a database schema that is different from the database schema used by the providers that ship with the .NET Framework. A common example of this would be membership data that already exists in a SQL Server database for a company or Web site.

The MembershipProvider abstract class inherits from the ProviderBase abstract class. MembershipProvider implementations must also implement the required members of ProviderBase.

TopicLocation
How to: Sample Membership Provider ImplementationBuilding ASP .NET Web Applications
How to: Implement a Custom Membership UserBuilding ASP .NET Web Applications
Implementing a Membership ProviderBuilding ASP .NET Web Applications
How to: Sample Membership Provider ImplementationBuilding ASP .NET Web Applications
Implementing a Membership ProviderBuilding ASP .NET Web Applications
How to: Implement a Custom Membership UserBuilding ASP .NET Web Applications

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft. All rights reserved.