SimpleMembershipProvider Class

Provides support for website membership tasks, such as creating accounts, deleting accounts, and managing passwords.

Inheritance Hierarchy

System.Object
  System.Configuration.Provider.ProviderBase
    System.Web.Security.MembershipProvider
      WebMatrix.WebData.ExtendedMembershipProvider
        WebMatrix.WebData.SimpleMembershipProvider

Namespace:  WebMatrix.WebData
Assembly:  WebMatrix.WebData (in WebMatrix.WebData.dll)

Syntax

'Declaration
Public Class SimpleMembershipProvider _
    Inherits ExtendedMembershipProvider
'Usage
Dim instance As SimpleMembershipProvider
public class SimpleMembershipProvider : ExtendedMembershipProvider
public ref class SimpleMembershipProvider : public ExtendedMembershipProvider
type SimpleMembershipProvider =  
    class 
        inherit ExtendedMembershipProvider 
    end
public class SimpleMembershipProvider extends ExtendedMembershipProvider

The SimpleMembershipProvider type exposes the following members.

Constructors

  Name Description
Public method SimpleMembershipProvider() Initializes a new instance of the SimpleMembershipProvider class.
Public method SimpleMembershipProvider(MembershipProvider) Initializes a new instance of the SimpleMembershipProvider class by using the specified membership provider.

Top

Properties

  Name Description
Public property ApplicationName Gets or sets the name of the application. (Overrides MembershipProvider.ApplicationName.)
Public property CasingBehavior Gets or sets the SimpleMembershipProviderCasingBehavior for this provider.
Public property Description (Inherited from ProviderBase.)
Public property EnablePasswordReset Gets a value that indicates whether the membership provider lets users reset their passwords. (Overrides MembershipProvider.EnablePasswordReset.)
Public property EnablePasswordRetrieval Gets a value that indicates whether the membership provider lets users retrieve their passwords. (Overrides MembershipProvider.EnablePasswordRetrieval.)
Public property MaxInvalidPasswordAttempts Gets the number of invalid password or password-answer attempts that are allowed before the membership user is locked out. (Overrides MembershipProvider.MaxInvalidPasswordAttempts.)
Public property MinRequiredNonAlphanumericCharacters Gets the minimum number of special (non-alphanumeric) characters that a password must contain. (Overrides MembershipProvider.MinRequiredNonAlphanumericCharacters.)
Public property MinRequiredPasswordLength Gets the minimum length that is required for a password. (Overrides MembershipProvider.MinRequiredPasswordLength.)
Public property Name (Inherited from ProviderBase.)
Public property PasswordAttemptWindow Gets the number of minutes during which the maximum number of invalid password or security-question answer attempts are allowed before the user account is locked out. (Overrides MembershipProvider.PasswordAttemptWindow.)
Public property PasswordFormat Gets a value that indicates the format for storing passwords. (Overrides MembershipProvider.PasswordFormat.)
Public property PasswordStrengthRegularExpression Gets the regular expression that is used to evaluate password complexity. (Overrides MembershipProvider.PasswordStrengthRegularExpression.)
Public property RequiresQuestionAndAnswer Gets a value that indicates whether the membership provider requires that the user answer a security question for password reset and retrieval. (Overrides MembershipProvider.RequiresQuestionAndAnswer.)
Public property RequiresUniqueEmail Gets a value that indicates whether the membership provider requires a unique email address for each user name. (Overrides MembershipProvider.RequiresUniqueEmail.)
Public property UserIdColumn Gets or sets the name of the database column that contains user IDs.
Public property UserNameColumn Gets or sets the name of the database column that contains user names.
Public property UserTableName Gets or sets the name of the database table that contains user information.

Top

Methods

  Name Description
Public method ChangePassword Changes the password for the specified membership account. (Overrides MembershipProvider.ChangePassword(String, String, String).)
Public method ChangePasswordQuestionAndAnswer Changes the password question and answer for the specified account. (Overrides MembershipProvider.ChangePasswordQuestionAndAnswer(String, String, String, String).)
Public method ConfirmAccount(String) Activates a pending membership account. (Overrides ExtendedMembershipProvider.ConfirmAccount(String).)
Public method ConfirmAccount(String, String) Indicates whether the user account is confirmed. (Overrides ExtendedMembershipProvider.ConfirmAccount(String, String).)
Public method CreateAccount(String, String) Creates a new user account using the specified user name and password. (Inherited from ExtendedMembershipProvider.)
Public method CreateAccount(String, String, Boolean) Creates a new user account by using the specified user name and password. (Overrides ExtendedMembershipProvider.CreateAccount(String, String, Boolean).)
Public method CreateOrUpdateOAuthAccount Creates a new OAuth membership account, or updates an existing OAuth Membership account. (Overrides ExtendedMembershipProvider.CreateOrUpdateOAuthAccount(String, String, String).)
Public method CreateUser Adds the specified user to the membership database. (Overrides MembershipProvider.CreateUser(String, String, String, String, String, Boolean, Object, MembershipCreateStatus%).)
Public method CreateUserAndAccount(String, String) Creates a new user profile and a new membership account. (Inherited from ExtendedMembershipProvider.)
Public method CreateUserAndAccount(String, String, Boolean) Creates a new user profile and a new membership account. (Inherited from ExtendedMembershipProvider.)
Public method CreateUserAndAccount(String, String, IDictionary<String, Object>) When overridden in a derived class, creates a new user profile and a new membership account. (Inherited from ExtendedMembershipProvider.)
Public method CreateUserAndAccount(String, String, Boolean, IDictionary<String, Object>) Creates a new user profile and a new membership account. (Overrides ExtendedMembershipProvider.CreateUserAndAccount(String, String, Boolean, IDictionary<String, Object>).)
Protected method DecryptPassword (Inherited from MembershipProvider.)
Public method DeleteAccount Deletes the specified membership account. (Overrides ExtendedMembershipProvider.DeleteAccount(String).)
Public method DeleteOAuthAccount Deletes the OAuth or OpenID account with the specified provider name and provider user ID. (Overrides ExtendedMembershipProvider.DeleteOAuthAccount(String, String).)
Public method DeleteOAuthToken Deletes the specified OAuth token. (Overrides ExtendedMembershipProvider.DeleteOAuthToken(String).)
Public method DeleteUser Deletes the specified user account, and optionally deletes all profile data that is related to that user account. (Overrides MembershipProvider.DeleteUser(String, Boolean).)
Protected method EncryptPassword(array<Byte[]) (Inherited from MembershipProvider.)
Protected method EncryptPassword(array<Byte[], MembershipPasswordCompatibilityMode) (Inherited from MembershipProvider.)
Public method Equals (Inherited from Object.)
Protected method Finalize (Inherited from Object.)
Public method FindUsersByEmail Returns all of the user accounts whose email address matches the specified email address. (Overrides MembershipProvider.FindUsersByEmail(String, Int32, Int32, Int32%).)
Public method FindUsersByName Returns all of the user accounts whose name matches the specified user name. (Overrides MembershipProvider.FindUsersByName(String, Int32, Int32, Int32%).)
Public method GeneratePasswordResetToken(String) Generates a password reset token that can be sent to a user in email. (Inherited from ExtendedMembershipProvider.)
Public method GeneratePasswordResetToken(String, Int32) Generates a password reset token that can be sent to a user in email. (Overrides ExtendedMembershipProvider.GeneratePasswordResetToken(String, Int32).)
Public method GetAccountsForUser Returns all OAuth membership accounts that are associated with the specified user name. (Overrides ExtendedMembershipProvider.GetAccountsForUser(String).)
Public method GetAllUsers Returns all of the user accounts in the data source. (Overrides MembershipProvider.GetAllUsers(Int32, Int32, Int32%).)
Public method GetCreateDate Returns the date and time when the specified user account was created. (Overrides ExtendedMembershipProvider.GetCreateDate(String).)
Public method GetHashCode (Inherited from Object.)
Public method GetLastPasswordFailureDate Returns the date and time when an incorrect password was most recently entered for the specified user account. (Overrides ExtendedMembershipProvider.GetLastPasswordFailureDate(String).)
Public method GetNumberOfUsersOnline Returns the number of users who are currently accessing the application. (Overrides MembershipProvider.GetNumberOfUsersOnline().)
Public method GetOAuthTokenSecret Returns the OAuth token secret. (Overrides ExtendedMembershipProvider.GetOAuthTokenSecret(String).)
Public method GetPassword Returns the password for the specified user account from the data source. (Overrides MembershipProvider.GetPassword(String, String).)
Public method GetPasswordChangedDate Returns the date and time when the password was most recently changed for the specified membership account. (Overrides ExtendedMembershipProvider.GetPasswordChangedDate(String).)
Public method GetPasswordFailuresSinceLastSuccess Returns the number of times that the password for the specified user account was incorrectly entered since the most recent successful login or since the user account was created. (Overrides ExtendedMembershipProvider.GetPasswordFailuresSinceLastSuccess(String).)
Public method GetType (Inherited from Object.)
Public method GetUser(Object, Boolean) Returns information about the user account using the specified user ID, and optionally updates the timestamp of the most recent activity for the user account. (Overrides MembershipProvider.GetUser(Object, Boolean).)
Public method GetUser(String, Boolean) Returns information about the user account using the specified user name, and optionally updates the timestamp of the most recent activity for the user account. (Overrides MembershipProvider.GetUser(String, Boolean).)
Public method GetUserId Returns the ID for a user based on the specified user name.
Public method GetUserIdFromOAuth Returns the user ID for the specified OAuth or OpenID provider and provider user ID. (Overrides ExtendedMembershipProvider.GetUserIdFromOAuth(String, String).)
Public method GetUserIdFromPasswordResetToken Returns the ID for a user based on a password reset token. (Overrides ExtendedMembershipProvider.GetUserIdFromPasswordResetToken(String).)
Public method GetUserNameByEmail Returns the user name that is associated with the specified email address. (Overrides MembershipProvider.GetUserNameByEmail(String).)
Public method GetUserNameFromId Returns the user name that is associated with the specified user ID. (Overrides ExtendedMembershipProvider.GetUserNameFromId(Int32).)
Public method HasLocalAccount Indicates whether the user has local account. (Overrides ExtendedMembershipProvider.HasLocalAccount(Int32).)
Public method Initialize Initializes the provider. (Overrides ProviderBase.Initialize(String, NameValueCollection).)
Public method IsConfirmed Returns a value that indicates whether the user account has been confirmed by the provider. (Overrides ExtendedMembershipProvider.IsConfirmed(String).)
Protected method MemberwiseClone (Inherited from Object.)
Protected method OnValidatingPassword (Inherited from MembershipProvider.)
Public method ReplaceOAuthRequestTokenWithAccessToken Replaces OAuth request token with access token. (Overrides ExtendedMembershipProvider.ReplaceOAuthRequestTokenWithAccessToken(String, String, String).)
Public method ResetPassword Resets the password for a user account to a new, automatically generated password. (Overrides MembershipProvider.ResetPassword(String, String).)
Public method ResetPasswordWithToken Resets a password after verifying that the specified password reset token is valid. (Overrides ExtendedMembershipProvider.ResetPasswordWithToken(String, String).)
Public method StoreOAuthRequestToken Stores an OAuth request token. (Overrides ExtendedMembershipProvider.StoreOAuthRequestToken(String, String).)
Public method ToString (Inherited from Object.)
Public method UnlockUser Unlocks a user account so that the membership user can be validated. (Overrides MembershipProvider.UnlockUser(String).)
Public method UpdateUser Updates user information. (Overrides MembershipProvider.UpdateUser(MembershipUser).)
Public method ValidateUser Verifies that the specified user account and password exist. (Overrides MembershipProvider.ValidateUser(String, String).)

Top

Events

  Name Description
Public event ValidatingPassword (Inherited from MembershipProvider.)

Top

Remarks

The WebSecurity helper class is the recommended way to manage user (membership) accounts, passwords, and other membership tasks. The SimpleMembershipProvider class can manage membership tasks; however, it is not recommended because WebSecurity provides a simpler way to implement membership. The SimpleMembershipProvider class is intended for developers who require more precise control over the membership process.

In ASP.NET Web Pages sites, you can access the functionality of the SimpleMembershipProvider class by using the Membership property of a web page. You do not (in fact, cannot) initialize a new instance of the SimpleMembershipProvider class.

By design, the SimpleMembershipProvider class does not implement the full range of functionality that is possible in ASP.NET membership providers, as defined in the MembershipProvider class that is used by all ASP.NET membership providers. Some members are available in the class because they are inherited from the base class, but will throw an exception if you access them.

If your website requires the full membership provider capabilities, you can skip initialization of the Web Pages membership system (that is, do not call WebSecurity.InitializeDatabaseConnection()) and instead make sure that the standard membership and role providers are enabled. In that case, calls that you make to the SimpleMembershipProvider class are passed through to the standard provider (which is referred to as the previous provider in the SimpleMembershipProvider class documentation). For more information, see Configuring an ASP.NET Application to Use Membership.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

WebMatrix.WebData Namespace