Click or drag to resize

MySQLMembershipProvider Class

Manages storage of membership information for an ASP.NET application in a MySQL database.
Inheritance Hierarchy

Namespace:  MySql.Web.Security
Assembly:  MySql.Web (in MySql.Web.dll) Version: 8.0.22
Syntax
public sealed class MySQLMembershipProvider : MembershipProvider

The MySQLMembershipProvider type exposes the following members.

Constructors
  NameDescription
Public methodMySQLMembershipProvider
Initializes a new instance of the MySQLMembershipProvider class
Top
Properties
  NameDescription
Public propertyCode exampleApplicationName
The name of the application using the MySQL membership provider.
(Overrides MembershipProviderApplicationName.)
Public propertyDescription
Gets a brief, friendly description suitable for display in administrative tools or other user interfaces (UIs).
(Inherited from ProviderBase.)
Public propertyCode exampleEnablePasswordReset
Indicates whether the membership provider is configured to allow users to reset their passwords.
(Overrides MembershipProviderEnablePasswordReset.)
Public propertyCode exampleEnablePasswordRetrieval
Indicates whether the membership provider is configured to allow users to retrieve their passwords.
(Overrides MembershipProviderEnablePasswordRetrieval.)
Public propertyCode exampleMaxInvalidPasswordAttempts
Gets the number of invalid password or password-answer attempts allowed before the membership user is locked out.
(Overrides MembershipProviderMaxInvalidPasswordAttempts.)
Public propertyCode exampleMinRequiredNonAlphanumericCharacters
Gets the minimum number of special characters that must be present in a valid password.
(Overrides MembershipProviderMinRequiredNonAlphanumericCharacters.)
Public propertyCode exampleMinRequiredPasswordLength
Gets the minimum length required for a password.
(Overrides MembershipProviderMinRequiredPasswordLength.)
Public propertyName
Gets the friendly name used to refer to the provider during configuration.
(Inherited from ProviderBase.)
Public propertyCode examplePasswordAttemptWindow
Gets 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.
(Overrides MembershipProviderPasswordAttemptWindow.)
Public propertyCode examplePasswordFormat
Gets a value indicating the format for storing passwords in the membership data store.
(Overrides MembershipProviderPasswordFormat.)
Public propertyCode examplePasswordStrengthRegularExpression
Gets the regular expression used to evaluate a password.
(Overrides MembershipProviderPasswordStrengthRegularExpression.)
Public propertyCode exampleRequiresQuestionAndAnswer
Gets a value indicating whether the membership provider is configured to require the user to answer a password question for password reset and retrieval.
(Overrides MembershipProviderRequiresQuestionAndAnswer.)
Public propertyCode exampleRequiresUniqueEmail
Gets a value indicating whether the membership provider is configured to require a unique e-mail address for each user name.
(Overrides MembershipProviderRequiresUniqueEmail.)
Public propertyWriteExceptionsToEventLog
Gets or sets a value indicating whether exceptions are written to the event log.
Top
Methods
  NameDescription
Public methodChangePassword
Changes the password.
(Overrides MembershipProviderChangePassword(String, String, String).)
Public methodChangePasswordQuestionAndAnswer
Changes the password question and answer.
(Overrides MembershipProviderChangePasswordQuestionAndAnswer(String, String, String, String).)
Public methodCreateUser
Adds a new membership user to the data source.
(Overrides MembershipProviderCreateUser(String, String, String, String, String, Boolean, Object, MembershipCreateStatus).)
Protected methodDecryptPassword
Decrypts an encrypted password.
(Inherited from MembershipProvider.)
Public methodDeleteUser
Removes a user from the membership data source.
(Overrides MembershipProviderDeleteUser(String, Boolean).)
Protected methodEncryptPassword(Byte)
Encrypts a password.
(Inherited from MembershipProvider.)
Protected methodEncryptPassword(Byte, MembershipPasswordCompatibilityMode)
Encrypts the specified password using the specified password-compatibility mode.
(Inherited from MembershipProvider.)
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodFindUsersByEmail
Gets a collection of membership users where the e-mail address contains the specified e-mail address to match.
(Overrides MembershipProviderFindUsersByEmail(String, Int32, Int32, Int32).)
Public methodFindUsersByName
Gets a collection of membership users where the user name contains the specified user name to match.
(Overrides MembershipProviderFindUsersByName(String, Int32, Int32, Int32).)
Public methodGetAllUsers
Gets a collection of all the users in the data source in pages of data.
(Overrides MembershipProviderGetAllUsers(Int32, Int32, Int32).)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetNumberOfUsersOnline
Gets the number of users currently accessing the application.
(Overrides MembershipProviderGetNumberOfUsersOnline.)
Public methodGetPassword
Gets the password for the specified user name from the data source.
(Overrides MembershipProviderGetPassword(String, String).)
Public methodGetType
Gets 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.
(Overrides MembershipProviderGetUser(Object, Boolean).)
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.
(Overrides MembershipProviderGetUser(String, Boolean).)
Public methodGetUserNameByEmail
Gets the user name associated with the specified e-mail address.
(Overrides MembershipProviderGetUserNameByEmail(String).)
Public methodInitialize
Initializes the MySQL membership provider with the property values specified in the ASP.NET application's configuration file. This method is not intended to be used directly from your code.
(Overrides ProviderBaseInitialize(String, NameValueCollection).)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodOnValidatingPassword
Raises the ValidatingPassword event if an event handler has been defined.
(Inherited from MembershipProvider.)
Public methodResetPassword
Resets a user's password to a new, automatically generated password.
(Overrides MembershipProviderResetPassword(String, String).)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodUnlockUser
Unlocks the user.
(Overrides MembershipProviderUnlockUser(String).)
Public methodUpdateUser
Updates information about a user in the data source.
(Overrides MembershipProviderUpdateUser(MembershipUser).)
Public methodValidateUser
Verifies that the specified user name and password exist in the data source.
(Overrides MembershipProviderValidateUser(String, String).)
Top
Events
  NameDescription
Public eventValidatingPassword
Occurs when a user is created, a password is changed, or a password is reset.
(Inherited from MembershipProvider.)
Top
Remarks

This class is used by the Membership and MembershipUser classes to provide membership services for ASP.NET applications using a MySQL database.

Examples
<configuration>
  <connectionStrings>
    <add name="LocalMySqlService" connectionString="server=localhost;user id=myuser;password=mypass;database=test" />
  </connectionStrings>
  <system.web>
    <authentication mode="Forms" >
      <forms loginUrl="login.aspx"
        name=".ASPXFORMSAUTH" />
    </authentication>
    <authorization>
      <deny users="?" />
    </authorization>
    <membership defaultProvider="MySQLProvider" userIsOnlineTimeWindow="15">
      <providers>
        <add
          name="MySQLProvider"
          type="MySql.Web.Security.MySQLMembershipProvider"
          connectionStringName="LocalMySqlService"
          applicationName="MyApplication"
          enablePasswordRetrieval="false"
          enablePasswordReset="true"
          requiresQuestionAndAnswer="true"
          requiresUniqueEmail="false"
          passwordFormat="Hashed"
          maxInvalidPasswordAttempts="5"
          passwordAttemptWindow="10" />
      </providers>
    </membership>
  </system.web>
</configuration>
See Also