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 | |
---|---|---|
SimpleMembershipProvider() | Initializes a new instance of the SimpleMembershipProvider class. | |
SimpleMembershipProvider(MembershipProvider) | Initializes a new instance of the SimpleMembershipProvider class by using the specified membership provider. |
Top
Properties
Name | Description | |
---|---|---|
ApplicationName | Gets or sets the name of the application. (Overrides MembershipProvider.ApplicationName.) | |
CasingBehavior | Gets or sets the SimpleMembershipProviderCasingBehavior for this provider. | |
Description | (Inherited from ProviderBase.) | |
EnablePasswordReset | Gets a value that indicates whether the membership provider lets users reset their passwords. (Overrides MembershipProvider.EnablePasswordReset.) | |
EnablePasswordRetrieval | Gets a value that indicates whether the membership provider lets users retrieve their passwords. (Overrides MembershipProvider.EnablePasswordRetrieval.) | |
MaxInvalidPasswordAttempts | Gets the number of invalid password or password-answer attempts that are allowed before the membership user is locked out. (Overrides MembershipProvider.MaxInvalidPasswordAttempts.) | |
MinRequiredNonAlphanumericCharacters | Gets the minimum number of special (non-alphanumeric) characters that a password must contain. (Overrides MembershipProvider.MinRequiredNonAlphanumericCharacters.) | |
MinRequiredPasswordLength | Gets the minimum length that is required for a password. (Overrides MembershipProvider.MinRequiredPasswordLength.) | |
Name | (Inherited from ProviderBase.) | |
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.) | |
PasswordFormat | Gets a value that indicates the format for storing passwords. (Overrides MembershipProvider.PasswordFormat.) | |
PasswordStrengthRegularExpression | Gets the regular expression that is used to evaluate password complexity. (Overrides MembershipProvider.PasswordStrengthRegularExpression.) | |
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.) | |
RequiresUniqueEmail | Gets a value that indicates whether the membership provider requires a unique email address for each user name. (Overrides MembershipProvider.RequiresUniqueEmail.) | |
UserIdColumn | Gets or sets the name of the database column that contains user IDs. | |
UserNameColumn | Gets or sets the name of the database column that contains user names. | |
UserTableName | Gets or sets the name of the database table that contains user information. |
Top
Methods
Name | Description | |
---|---|---|
ChangePassword | Changes the password for the specified membership account. (Overrides MembershipProvider.ChangePassword(String, String, String).) | |
ChangePasswordQuestionAndAnswer | Changes the password question and answer for the specified account. (Overrides MembershipProvider.ChangePasswordQuestionAndAnswer(String, String, String, String).) | |
ConfirmAccount(String) | Activates a pending membership account. (Overrides ExtendedMembershipProvider.ConfirmAccount(String).) | |
ConfirmAccount(String, String) | Indicates whether the user account is confirmed. (Overrides ExtendedMembershipProvider.ConfirmAccount(String, String).) | |
CreateAccount(String, String) | Creates a new user account using the specified user name and password. (Inherited from ExtendedMembershipProvider.) | |
CreateAccount(String, String, Boolean) | Creates a new user account by using the specified user name and password. (Overrides ExtendedMembershipProvider.CreateAccount(String, String, Boolean).) | |
CreateOrUpdateOAuthAccount | Creates a new OAuth membership account, or updates an existing OAuth Membership account. (Overrides ExtendedMembershipProvider.CreateOrUpdateOAuthAccount(String, String, String).) | |
CreateUser | Adds the specified user to the membership database. (Overrides MembershipProvider.CreateUser(String, String, String, String, String, Boolean, Object, MembershipCreateStatus%).) | |
CreateUserAndAccount(String, String) | Creates a new user profile and a new membership account. (Inherited from ExtendedMembershipProvider.) | |
CreateUserAndAccount(String, String, Boolean) | Creates a new user profile and a new membership account. (Inherited from ExtendedMembershipProvider.) | |
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.) | |
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>).) | |
DecryptPassword | (Inherited from MembershipProvider.) | |
DeleteAccount | Deletes the specified membership account. (Overrides ExtendedMembershipProvider.DeleteAccount(String).) | |
DeleteOAuthAccount | Deletes the OAuth or OpenID account with the specified provider name and provider user ID. (Overrides ExtendedMembershipProvider.DeleteOAuthAccount(String, String).) | |
DeleteOAuthToken | Deletes the specified OAuth token. (Overrides ExtendedMembershipProvider.DeleteOAuthToken(String).) | |
DeleteUser | Deletes the specified user account, and optionally deletes all profile data that is related to that user account. (Overrides MembershipProvider.DeleteUser(String, Boolean).) | |
EncryptPassword(Byte[]) | (Inherited from MembershipProvider.) | |
EncryptPassword(Byte[], MembershipPasswordCompatibilityMode) | (Inherited from MembershipProvider.) | |
Equals | (Inherited from Object.) | |
Finalize | (Inherited from Object.) | |
FindUsersByEmail | Returns all of the user accounts whose email address matches the specified email address. (Overrides MembershipProvider.FindUsersByEmail(String, Int32, Int32, Int32%).) | |
FindUsersByName | Returns all of the user accounts whose name matches the specified user name. (Overrides MembershipProvider.FindUsersByName(String, Int32, Int32, Int32%).) | |
GeneratePasswordResetToken(String) | Generates a password reset token that can be sent to a user in email. (Inherited from ExtendedMembershipProvider.) | |
GeneratePasswordResetToken(String, Int32) | Generates a password reset token that can be sent to a user in email. (Overrides ExtendedMembershipProvider.GeneratePasswordResetToken(String, Int32).) | |
GetAccountsForUser | Returns all OAuth membership accounts that are associated with the specified user name. (Overrides ExtendedMembershipProvider.GetAccountsForUser(String).) | |
GetAllUsers | Returns all of the user accounts in the data source. (Overrides MembershipProvider.GetAllUsers(Int32, Int32, Int32%).) | |
GetCreateDate | Returns the date and time when the specified user account was created. (Overrides ExtendedMembershipProvider.GetCreateDate(String).) | |
GetHashCode | (Inherited from Object.) | |
GetLastPasswordFailureDate | Returns the date and time when an incorrect password was most recently entered for the specified user account. (Overrides ExtendedMembershipProvider.GetLastPasswordFailureDate(String).) | |
GetNumberOfUsersOnline | Returns the number of users who are currently accessing the application. (Overrides MembershipProvider.GetNumberOfUsersOnline().) | |
GetOAuthTokenSecret | Returns the OAuth token secret. (Overrides ExtendedMembershipProvider.GetOAuthTokenSecret(String).) | |
GetPassword | Returns the password for the specified user account from the data source. (Overrides MembershipProvider.GetPassword(String, String).) | |
GetPasswordChangedDate | Returns the date and time when the password was most recently changed for the specified membership account. (Overrides ExtendedMembershipProvider.GetPasswordChangedDate(String).) | |
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).) | |
GetType | (Inherited from Object.) | |
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).) | |
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).) | |
GetUserId | Returns the ID for a user based on the specified user name. | |
GetUserIdFromOAuth | Returns the user ID for the specified OAuth or OpenID provider and provider user ID. (Overrides ExtendedMembershipProvider.GetUserIdFromOAuth(String, String).) | |
GetUserIdFromPasswordResetToken | Returns the ID for a user based on a password reset token. (Overrides ExtendedMembershipProvider.GetUserIdFromPasswordResetToken(String).) | |
GetUserNameByEmail | Returns the user name that is associated with the specified email address. (Overrides MembershipProvider.GetUserNameByEmail(String).) | |
GetUserNameFromId | Returns the user name that is associated with the specified user ID. (Overrides ExtendedMembershipProvider.GetUserNameFromId(Int32).) | |
HasLocalAccount | Indicates whether the user has local account. (Overrides ExtendedMembershipProvider.HasLocalAccount(Int32).) | |
Initialize | Initializes the provider. (Overrides ProviderBase.Initialize(String, NameValueCollection).) | |
IsConfirmed | Returns a value that indicates whether the user account has been confirmed by the provider. (Overrides ExtendedMembershipProvider.IsConfirmed(String).) | |
MemberwiseClone | (Inherited from Object.) | |
OnValidatingPassword | (Inherited from MembershipProvider.) | |
ReplaceOAuthRequestTokenWithAccessToken | Replaces OAuth request token with access token. (Overrides ExtendedMembershipProvider.ReplaceOAuthRequestTokenWithAccessToken(String, String, String).) | |
ResetPassword | Resets the password for a user account to a new, automatically generated password. (Overrides MembershipProvider.ResetPassword(String, String).) | |
ResetPasswordWithToken | Resets a password after verifying that the specified password reset token is valid. (Overrides ExtendedMembershipProvider.ResetPasswordWithToken(String, String).) | |
StoreOAuthRequestToken | Stores an OAuth request token. (Overrides ExtendedMembershipProvider.StoreOAuthRequestToken(String, String).) | |
ToString | (Inherited from Object.) | |
UnlockUser | Unlocks a user account so that the membership user can be validated. (Overrides MembershipProvider.UnlockUser(String).) | |
UpdateUser | Updates user information. (Overrides MembershipProvider.UpdateUser(MembershipUser).) | |
ValidateUser | Verifies that the specified user account and password exist. (Overrides MembershipProvider.ValidateUser(String, String).) |
Top
Events
Name | Description | |
---|---|---|
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.