ChangePassword.NewPasswordRegularExpression プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ChangePassword.NewPasswordRegularExpression プロパティの意味・解説 

ChangePassword.NewPasswordRegularExpression プロパティ

メモ : このプロパティは、.NET Framework version 2.0 で新しく追加されたものです。

ユーザーが入力したパスワードの検証に使用される正規表現を取得または設定します。

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public Overridable Property
 NewPasswordRegularExpression As String
Dim instance As ChangePassword
Dim value As String

value = instance.NewPasswordRegularExpression

instance.NewPasswordRegularExpression = value
public virtual string NewPasswordRegularExpression
 { get; set; }
public:
virtual property String^ NewPasswordRegularExpression {
    String^ get ();
    void set (String^ value);
}
/** @property */
public String get_NewPasswordRegularExpression ()

/** @property */
public void set_NewPasswordRegularExpression
 (String value)
public function get NewPasswordRegularExpression
 () : String

public function set NewPasswordRegularExpression
 (value : String)

プロパティ値
ユーザーが入力したパスワードの検証に使用される正規表現文字列。既定値は Empty です。

解説解説

NewPasswordRegularExpression プロパティを使用して、Web サイトのユーザー アカウントの検証に使用するパスワードに対する要件を定義します。この正規表現は、クライアント側でパスワード規則を強制するために使用されます。NewPasswordRegularExpression は、データ ストア レベルで構成できるパスワードの強制には関係ありません。パスワードは、MinRequiredPasswordLength、MinRequiredNonAlphanumericCharacters、および PasswordStrengthRegularExpression の各プロパティのメンバシップ プロバイダによって設定される最低限の条件を満たす必要があります。パスワードがこれらの要件を満たしていない場合、ChangePasswordError イベントが発生します。

要件をユーザーに表示するには、PasswordHintText プロパティを設定します。

入力されたパスワードが NewPasswordRegularExpression プロパティに格納されている正規表現に適合しない場合、NewPasswordRegularExpressionErrorMessage プロパティに格納されているテキストがユーザーに表示されます。

パスワードがメンバシップ プロバイダに拒否された場合は、ChangePasswordFailureText プロパティに格納されているテキストが表示されます。

パスワード標準の一般的な用途は、厳密なパスワードの選択をユーザーに強制することです。メンバシップ プロバイダのデータ レベルでパスワード規則を強制することをお勧めします。NewPasswordRegularExpression プロパティは、クライアント側のパスワード チェックに便利ですが、繰り返しログオンを試行するユーザーをロック アウトできません。セキュリティを強化するには、メンバシップ プロバイダを設定して、ユーザーがログオンの試行を実行できる回数を制限します。詳細については、「メンバシップのセキュリティ保護」を参照してください。

使用例使用例

NewPasswordRegularExpression プロパティを設定して、以下の基準に一致するようにパスワードをチェックする正規表現を定義する方法を次のコード例に示します。

PasswordHintText プロパティに格納されたパスワード要件は、ユーザーに表示されます。

ユーザーの入力したパスワードが基準を満たしていない場合、NewPasswordRegularExpressionErrorMessage プロパティに格納されたテキストがユーザーに表示されます。新しいパスワードが入力されない場合、NewPasswordRequiredErrorMessage プロパティに格納されたテキストがユーザーに表示されます。

メモメモ

新しいパスワードは、MinRequiredPasswordLength、MinRequiredNonAlphanumericCharacters、および PasswordStrengthRegularExpression の各プロパティのメンバシップ プロバイダによって設定される最低限の条件を満たす必要もあります。パスワードがこれらの要件を満たしていない場合、ChangePasswordError イベントが発生します。

<%@ page language="VB"%>

<script runat="server">

</script>

<html>
<head runat="server">
  <title>Change Password with Validation</title>
</head>
<body>
  <form id="form1" runat="server">
  <div>
  <asp:changepassword id="ChangePassword1" runat="server"
  PasswordHintText = "Please enter a password at least 7 characters
 long, containing a number and one special character."
  NewPasswordRegularExpression = '@\"(?=.{7,})(?=(.*\d){1,})(?=(.*\W){1,})'
 
  NewPasswordRegularExpressionErrorMessage = "Your password must
 be at least 7 characters long, and contain at least one number and one special
 character.">
  </asp:changepassword>
  </div>
  </form>
</body>
</html>
<%@ page language="C#"%>

<script runat="server">

</script>

<html>
<head runat="server">
  <title>Change Password with Validation</title>
</head>
<body>
  <form id="form1" runat="server">
  <div>
  <asp:changepassword id="ChangePassword1" runat="server"
  PasswordHintText = 
    "Please enter a password at least 7 characters long, 
    containing a number and one special character."
  NewPasswordRegularExpression =
    '@\"(?=.{7,})(?=(.*\d){1,})(?=(.*\W){1,})' 
  NewPasswordRegularExpressionErrorMessage =
    "Error: Your password must be at least 7 characters long, 
    and contain at least one number and one special character." >
  </asp:changepassword>
  </div>
  </form>
</body>
</html>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「ChangePassword.NewPasswordRegularExpression プロパティ」の関連用語

ChangePassword.NewPasswordRegularExpression プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ChangePassword.NewPasswordRegularExpression プロパティのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS