PasswordRecovery.UserNameFailureText プロパティ

定義

ユーザーが入力したユーザー名が Web サイトの有効なユーザー名ではない場合に表示するテキストを取得または設定します。

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

プロパティ値

ユーザーが入力したユーザー名が Web サイトの有効なユーザー名ではない場合に表示するテキスト。 既定値は、"個人情報にアクセスできませんでした。 再試行してください。"

次のコード例では、 プロパティを UserNameFailureText "ユーザー名が見つかりませんでした。 再試行してください。"

<%@ 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>
    <title>ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:PasswordRecovery id="PasswordRecovery1" runat="server" 
            GeneralFailureText="You password cannot be retrieved at this time. Please try again later." 
            QuestionFailureText="Your answer does not match the stored answer. Please try again." 
            UserNameFailureText="We couldn't find that user name. Please try again.">
            <FailureTextStyle backcolor="Red" forecolor="White"></FailureTextStyle>
        </asp:PasswordRecovery>
    </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">

    ' Insert page code here
    '

</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:PasswordRecovery id="PasswordRecovery1" runat="server" 
            GeneralFailureText="You password cannot be retrieved at this time. Please try again later." 
            QuestionFailureText="Your answer does not match the stored answer. Please try again." 
            UserNameFailureText="We couldn't find that user name. Please try again.">
            <FailureTextStyle backcolor="Red" forecolor="White"></FailureTextStyle>
        </asp:PasswordRecovery>
        <!-- Insert content here -->
    </form>
</body>
</html>

注釈

UserNameFailureTextプロパティには、ユーザーが プロパティで定義されているメンバーシップ プロバイダーによって認識されないユーザー名を入力したときに表示されるエラー メッセージがMembershipProvider含まれています。

プロパティのスタイル設定は、 FailureTextStyle プロパティ内のテキストの外観を UserNameFailureText 定義します。

プロパティにテンプレートを UserNameTemplate 割り当てると、 UserNameFailureText プロパティは省略可能 Literal なコントロールに表示され、 プロパティは ID "FailureText" に設定されます。

プロパティの既定のテキストは、サーバーのロケール設定に基づいてローカライズされます。

このプロパティの値を設定すると、デザイナー ツールを使用してリソース ファイルに自動的に保存できます。 詳細については、グローバリゼーションとローカライズに関するページを参照してくださいLocalizableAttribute

適用対象

こちらもご覧ください