PasswordRecovery.AnswerLookupError 事件
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
使用者沒有輸入密碼復原確認問題的正確解答時發生。
public:
event EventHandler ^ AnswerLookupError;
public event EventHandler AnswerLookupError;
member this.AnswerLookupError : EventHandler
Public Custom Event AnswerLookupError As EventHandler
事件類型
範例
如果使用者輸入密碼確認問題無效的答案,QuestionTitleText下列程式代碼範例會AnswerLookupError使用 事件來重設 屬性。
<%@ 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">
void PasswordRecovery1_UserLookupError(object sender, EventArgs e)
{
PasswordRecovery1.UserNameTitleText = "Try again";
PasswordRecovery1.TitleTextStyle.ForeColor = System.Drawing.Color.Red;
}
void PasswordRecovery1_AnswerLookupError(object sender, EventArgs e)
{
PasswordRecovery1.QuestionTitleText = "Try again";
PasswordRecovery1.TitleTextStyle.ForeColor = System.Drawing.Color.Red;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>ASP.NET Example</title>
</head>
<body>
<form id="form1" runat="server">
<asp:passwordrecovery id="PasswordRecovery1" runat="server"
questiontitletext="Password Confirmation Question"
usernametitletext="Get a new password" OnUserLookupError="PasswordRecovery1_UserLookupError" OnAnswerLookupError="PasswordRecovery1_AnswerLookupError">
<titletextstyle
font-names="Arial"
font-bold="True"
forecolor="White"
backcolor="Gray">
</titletextstyle>
</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">
Sub PasswordRecovery1_UserLookupError(ByVal sender As Object, ByVal e As System.EventArgs)
PasswordRecovery1.UserNameTitleText = "Try again"
PasswordRecovery1.TitleTextStyle.ForeColor = System.Drawing.Color.Red
End Sub
Sub PasswordRecovery1_AnswerLookupError(ByVal sender As Object, ByVal e As System.EventArgs)
PasswordRecovery1.QuestionTitleText = "Try again"
PasswordRecovery1.TitleTextStyle.ForeColor = System.Drawing.Color.Red
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>ASP.NET Example</title>
</head>
<body>
<form id="form1" runat="server">
<asp:passwordrecovery id="PasswordRecovery1" runat="server"
questiontitletext="Password Confirmation Question"
usernametitletext="Get a new password" OnUserLookupError="PasswordRecovery1_UserLookupError" OnAnswerLookupError="PasswordRecovery1_AnswerLookupError">
<titletextstyle
font-names="Arial"
font-bold="True"
forecolor="White"
backcolor="Gray">
</titletextstyle>
</asp:passwordrecovery>
</form>
</body>
</html>
備註
AnswerLookupError當屬性中MembershipProvider定義的成員資格提供者未驗證密碼修復問題的答案時,就會引發事件。
如果成員資格提供者不支援密碼復原問題和答案,則 AnswerLookupError 永遠不會引發事件。
如需如何處理事件的詳細資訊,請參閱 處理和引發事件。