System.Web.Security.Membership.ValidatingPassword Event

Occurs when a user is created, a password is changed, or a password is reset.

Syntax

public static event MembershipValidatePasswordEventHandler ValidatingPassword

Remarks

The MembershipProvider.ValidatingPassword event is raised when the MembershipProvider.CreateUser(string, string, string, string, string, bool, object, MembershipCreateStatus@) method, the MembershipProvider.ChangePassword(string, string, string) method, or the MembershipProvider.ResetPassword(string, string) method of a membership provider is called.

You can use the MembershipProvider.ValidatingPassword event to validate password formats and values for membership users.

You can cancel the current MembershipProvider.CreateUser(string, string, string, string, string, bool, object, MembershipCreateStatus@), MembershipProvider.ChangePassword(string, string, string), or MembershipProvider.ResetPassword(string, string) action by setting the ValidatePasswordEventArgs.Cancel property of the supplied System.Web.Security.ValidatePasswordEventArgs to true during the MembershipProvider.ValidatingPassword event.

If you cancel the current action by setting the ValidatePasswordEventArgs.Cancel property to true, you can set the ValidatePasswordEventArgs.FailureInformation property of the supplied System.Web.Security.ValidatePasswordEventArgs to an exception that describes the reason for the password-validation failure. The calling method will throw the exception that the ValidatePasswordEventArgs.FailureInformation property is set to. If the ValidatePasswordEventArgs.FailureInformation property is null, the caller will throw a generic password-validation-failure exception.

Requirements

Namespace: System.Web.Security
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0