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 文本的外观。

将模板分配给UserNameTemplate属性时,该UserNameFailureText属性将显示在属性设置为“FailureText”的ID可选Literal控件中。

属性的默认文本根据服务器的区域设置进行本地化。

设置此属性的值后,可以使用设计器工具自动保存到资源文件。 有关详细信息,请参阅 LocalizableAttribute全球化和本地化

适用于

另请参阅