共用方式為


CreateUserWizard.PasswordRegularExpressionErrorMessage 屬性

定義

取得或設定錯誤訊息,其顯示於輸入的密碼不符合網站的密碼需求時。

public:
 virtual property System::String ^ PasswordRegularExpressionErrorMessage { System::String ^ get(); void set(System::String ^ value); };
public virtual string PasswordRegularExpressionErrorMessage { get; set; }
member this.PasswordRegularExpressionErrorMessage : string with get, set
Public Overridable Property PasswordRegularExpressionErrorMessage As String

屬性值

String

錯誤訊息,其顯示於輸入的密碼未通過在 PasswordRegularExpression 屬性中定義之規則運算式的驗證時。 預設值為 [請輸入不同的密碼]。 控制項的預設文字會依據伺服器目前的地區設定進行當地語系化。

範例

下列程式碼範例會將 PasswordRequiredErrorMessage 屬性設定為向使用者說明輸入的密碼不符合 屬性中包含的 PasswordRegularExpression 正則運算式需求。 若要傳遞正則運算式,密碼必須:

  • 長度超過六個字元。

  • 至少包含一位數。

  • 至少包含一個特殊 (非英數位元) 字元。

<%@ page language="C#"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>CreateUserWizard.PasswordRegularExpression sample</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
      <asp:createuserwizard id="Createuserwizard1" runat="server" 
        passwordregularexpression='@\"(?:.{7,})(?=(.*\d){1,})(?=(.*\W){1,})'
        passwordregularexpressionerrormessage="Your password must be 7 characters long, and contain at least one number and one special character.">
      </asp:createuserwizard>
    </div>
    </form>
</body>
</html>
<%@ page language="VB"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>CreateUserWizard.PasswordRegularExpression sample</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
      <asp:createuserwizard id="Createuserwizard1" runat="server" 
        passwordregularexpression='@\"(?:.{7,})(?=(.*\d){1,})(?=(.*\W){1,})'
        passwordregularexpressionerrormessage="Your password must be 7 characters long, and contain at least one number and one special character.">
      </asp:createuserwizard>
    </div>
    </form>
</body>
</html>

備註

PasswordRegularExpressionErrorMessage使用 屬性通知使用者輸入的密碼不符合網站的密碼需求。

適用於

另請參閱