PasswordRecovery.GeneralFailureText 屬性

定義

取得或設定要在 PasswordRecovery 控制項的成員資格提供者發生問題時顯示的錯誤訊息。

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

屬性值

因為成員資格提供者發生問題,所以不會透過電子郵件傳送使用者密碼時所顯示的錯誤訊息。 預設值為 [嘗試擷取密碼失敗。 請再試一次」。

範例

下列程式碼範例會 GeneralFailureText 設定 屬性。

<%@ 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>

備註

當成員資格提供者管理控制項的使用者資訊 PasswordRecovery 時,屬性 GeneralFailureText 會顯示給使用者。 一般而言,當成員資格提供者無法連線到包含使用者資訊的資料存放區時, GeneralFailureText 就會顯示 屬性。

當提供者在資料庫中找不到指定的使用者名稱時,屬性中指定的 UserNameFailureText 文字會顯示在 UserName 檢視中。 當使用者輸入的答案不符合預存答案時,屬性 QuestionFailureText 會顯示在 [問題] 檢視中。 所有其他 GeneralFailureText 錯誤都會顯示 屬性。

屬性的外觀 GeneralFailureText 是由 屬性中的 FailureTextStyle 樣式設定所定義。

當您設定範本以定義控制項的外觀 PasswordRecovery 時, GeneralFailureText 屬性會顯示在選擇性 Literal 控制項中,且控制項識別碼設定為 「FailureText」。

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

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

適用於

另請參閱