Login.Authenticate 이벤트

정의

사용자가 인증될 때 발생합니다.

public:
 event System::Web::UI::WebControls::AuthenticateEventHandler ^ Authenticate;
public event System.Web.UI.WebControls.AuthenticateEventHandler Authenticate;
member this.Authenticate : System.Web.UI.WebControls.AuthenticateEventHandler 
Public Custom Event Authenticate As AuthenticateEventHandler 

이벤트 유형

예제

다음 코드 예제에서는 이벤트를 사용하여 Authenticate 사이트별 사용자 지정 인증 코드를 호출합니다.

<%@ 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">
private bool SiteSpecificAuthenticationMethod(string UserName, string Password)
{
    // Insert code that implements a site-specific custom 
    // authentication method here.
    //
    // This example implementation always returns false.
    return false;
}

private void OnAuthenticate(object sender, AuthenticateEventArgs e)
{
    bool Authenticated = false;
    Authenticated = SiteSpecificAuthenticationMethod(Login1.UserName, Login1.Password);

    e.Authenticated = Authenticated;
}

</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:Login id="Login1" runat="server"
                OnAuthenticate="OnAuthenticate">
            </asp:Login>
        </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">
Function SiteSpecificAuthenticationMethod(ByVal UserName As String, ByVal Password As String) As Boolean
    ' Insert code that implements a site-specific custom 
    ' authentication method here.
    '
    ' This example implementation always returns false.
    Return False
End Function

Sub OnAuthenticate(ByVal sender As Object, ByVal e As AuthenticateEventArgs)
    Dim Authenticated As Boolean
    Authenticated = SiteSpecificAuthenticationMethod(Login1.UserName, Login1.Password)

    e.Authenticated = Authenticated
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:Login id="Login1" runat="server"
                OnAuthenticate="OnAuthenticate">
            </asp:Login>

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

설명

Authenticate 이벤트는 사용자가 컨트롤을 사용하여 Login 웹 사이트에 로그인할 때 발생합니다. 사용자 지정 인증 체계는 이벤트를 사용하여 Authenticate 사용자를 인증할 수 있습니다.

Note

사용자가 컨트롤을 Login 사용하여 웹 사이트에 로그인하면 보기 상태의 모든 데이터와 모든 게시 데이터가 손실됩니다. 뷰 상태에 의존하는 경우 작업을 Authenticate 수행하지 마세요.

이벤트 처리에 대한 자세한 내용은 이벤트 처리 및 발생시키기를 참조하십시오.

상속자 참고

사용자 지정 인증 체계는 사용자가 인증되었음을 나타내도록 true 속성을 설정 Authenticated 해야 합니다.

사용자가 로그인 정보를 제출하면 컨트롤이 Login 먼저 이벤트를 발생 LoggingIn 시키고 Authenticate 이벤트를 발생시키고 마지막으로 이벤트를 발생합니다 LoggedIn .

적용 대상

추가 정보