PasswordRecovery.UserNameFailureText 屬性

定義

取得或設定要在使用者輸入的使用者名稱不是網站的有效使用者名稱時顯示的文字。

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

屬性值

當使用者輸入的使用者名稱不是網站的有效使用者名稱時顯示的文字。 預設值為 [我們無法存取您的資訊。 請再試一次」。

範例

下列程式碼範例會將 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 文字的外觀。

當您將範本指派給屬性時 UserNameTemplateUserNameFailureText 屬性會顯示在選擇性 Literal 控制項中, ID 並將 屬性設定為 「FailureText」。

屬性的預設文字會根據伺服器的地區設定進行當地語系化。

設定時,這個屬性的值可以使用設計工具自動儲存到資源檔。 如需詳細資訊,請參閱 LocalizableAttribute全球化和當地語系化

適用於

另請參閱