ValidatePasswordEventArgs.FailureInformation プロパティ
アセンブリ: System.Web (system.web.dll 内)

Dim instance As ValidatePasswordEventArgs Dim value As Exception value = instance.FailureInformation instance.FailureInformation = value
/** @property */ public Exception get_FailureInformation () /** @property */ public void set_FailureInformation (Exception value)
public function get FailureInformation () : Exception public function set FailureInformation (value : Exception)
パスワード検証エラーの理由を説明する Exception。

FailureInformation プロパティは、現在の CreateUser、ChangePassword、または ResetPassword の各アクションが Cancel プロパティが true に設定されることによってキャンセルされたときに使用されます。
FailureInformation プロパティは、パスワード検証エラーの理由を説明する例外に設定されます。呼び出し元のメソッドは、FailureInformation プロパティに設定された例外をスローします。FailureInformation プロパティが null 参照 (Visual Basic では Nothing) である場合、呼び出し元は汎用パスワード検証エラー例外をスローします。

次のコード例に、ユーザーが入力したパスワードの形式を検証し、必要な形式と一致しない場合は処理をキャンセルする ValidatingPassword イベントを示します。
Public Sub Page_Load() AddHandler Membership.ValidatingPassword, _ New MembershipValidatePasswordEventHandler(AddressOf OnValidatePassword) End Sub Public Sub OnValidatePassword(sender As Object, _ args As ValidatePasswordEventArgs) Dim r As System.Text.RegularExpressions.Regex = _ New System.Text.RegularExpressions.Regex("(?=.{6 ,})(?=(.*\d){1,})(?=(.*\W){1,})") If Not r.IsMatch(args.Password) Then args.FailureInformation = _ New HttpException("Password must be at least 6 characters long and " & _ "contain at least one number and one special character.") args.Cancel = True End If End Sub
public void Page_Load() { Membership.ValidatingPassword += new MembershipValidatePasswordEventHandler(OnValidatePassword); } public void OnValidatePassword(object sender , ValidatePasswordEventArgs args) { System.Text.RegularExpressions.Regex r = new System.Text.RegularExpressions.Regex(@"(?=.{6,})(?=(.*\d){1 ,})(?=(.*\W){1,})"); if (!r.IsMatch(args.Password)) { args.FailureInformation = new HttpException("Password must be at least 6 characters long and " + "contain at least one number and one special character."); args.Cancel = true; } }

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- ValidatePasswordEventArgs.FailureInformation プロパティのページへのリンク