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.