PasswordRecovery.UserNameFailureText 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置在用户输入的用户名不是网站的有效用户名时显示的文本。
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 该属性会显示在可选 Literal 控件中, ID 该属性设置为“FailureText”。
属性的默认文本基于服务器的区域设置进行本地化。
设置时,此属性的值可以使用设计器工具自动保存到资源文件中。 有关详细信息,请参阅LocalizableAttribute全球化和本地化。