Share via


PasswordRecovery.OnUserLookupError(EventArgs) 메서드

정의

UserLookupError 이벤트를 발생시킵니다.

protected:
 virtual void OnUserLookupError(EventArgs ^ e);
protected virtual void OnUserLookupError (EventArgs e);
abstract member OnUserLookupError : EventArgs -> unit
override this.OnUserLookupError : EventArgs -> unit
Protected Overridable Sub OnUserLookupError (e As EventArgs)

매개 변수

e
EventArgs

이벤트 데이터가 포함된 EventArgs입니다.

예제

다음 코드 예제에서는 사용자 지정 정의 PasswordRecovery 재정의 하는 컨트롤을 OnUserLookupError 변경 하는 방법을 UserNameTitleText 사용자가 암호 확인 질문에 대 한 잘못 된 답변을 입력 하는 경우 속성입니다.

<%@ 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">
    class CustomPasswordRecovery : PasswordRecovery
    {
        override protected void OnAnswerLookupError(EventArgs e)
        {
            QuestionTitleText = "Try again";
            TitleTextStyle.ForeColor = System.Drawing.Color.Red;
            base.OnAnswerLookupError(e);
        }
    }
    
        // Add the custom password recovery control to the page.
        void Page_Init(object sender, EventArgs e)
        {
            CustomPasswordRecovery passwordRecoveryControl = new CustomPasswordRecovery();
        
            passwordRecoveryControl.ID = "passwordRecoveryControl";
        
            PlaceHolder1.Controls.Add(passwordRecoveryControl);
        
        }
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
<form id="form1" runat="server">
    <p>
        <asp:placeholder id="PlaceHolder1" runat="server"></asp:placeholder>&nbsp;</p>

</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">
    Class CustomPasswordRecovery
        Inherits PasswordRecovery
        
        Overloads Sub OnAnswerLookupError(ByVal e As EventArgs)
            QuestionTitleText = "Try again"
            TitleTextStyle.ForeColor = System.Drawing.Color.Red
            MyBase.OnAnswerLookupError(e)
        End Sub
    End Class

    ' Add the custom password recovery control to the page.
    Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs)
        Dim passwordRecoveryControl As New CustomPasswordRecovery
        
        passwordRecoveryControl.ID = "passwordRecoveryControl"
        
        PlaceHolder1.Controls.Add(passwordRecoveryControl)
        
    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">
    <p>
        <asp:placeholder id="PlaceHolder1" runat="server"></asp:placeholder>&nbsp;</p>

</form>
</body>
</html>

설명

OnUserLookupError 멤버 자격 공급자가 초기 화면에 입력 한 사용자 이름을 찾을 수 없는 경우 메서드가 호출 됩니다. 기본 구현 발생을 UserLookupError 이벤트입니다.

이벤트가 발생하면 대리자를 통해 이벤트 처리기가 호출됩니다. 자세한 내용은 이벤트 처리 및 발생합니다.

또한 OnUserLookupError 메서드를 사용하면 파생 클래스가 대리자를 연결하지 않고도 이벤트를 처리할 수 있습니다. 이는 파생 클래스에서 이벤트를 처리하는 기본 방법입니다.

상속자 참고

파생 클래스에서 OnUserLookupError(EventArgs)를 재정의하는 경우 등록된 대리자가 이벤트를 받도록 기본 클래스의 OnUserLookupError(EventArgs) 메서드를 호출해야 합니다.

적용 대상

추가 정보