AuthenticateEventArgs.Authenticated 속성

정의

사용자의 인증 시도가 성공했는지 여부를 나타내는 값을 가져오거나 설정합니다.

public:
 property bool Authenticated { bool get(); void set(bool value); };
public bool Authenticated { get; set; }
member this.Authenticated : bool with get, set
Public Property Authenticated As Boolean

속성 값

인증 시도가 성공하면 true이고, 그렇지 않으면 false입니다.

예제

다음 코드 예제에서는 Authenticated 사용자의 로그인 시도의 성공 여부를 나타내는 사용자 지정 인증 체계를 사용 하는 속성입니다.

<%@ 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>

설명

사용 하 여를 Authenticated 에서 구현 되는 사용자 지정 인증 체계에서 속성을 Login.Authenticate 이벤트 처리기를 사용자의 로그인 시도의 성공 여부를 나타냅니다.

설정 된 Authenticated 속성을 false 웹 사이트 사용자가 유효한 자격 증명 나타나지 나타냅니다 및 Login 제어 시켜야는 LoginError 로그인 시도 나타내는 텍스트를 표시 하는 것 외에도 이벤트가 성공 하지 않음. LoginError 페이지 개발자 추가 프로세스 또는 사용자 인증에 실패 하는 경우 발생 하는 작업을 사용 하는 이벤트입니다. 설정 Authenticatedtrue 사용자에 게 유효한 자격 증명 표시에 나타냅니다 및 Login 컨트롤 시켜야 합니다 LoggedIn 이벤트 및 사용자 다시 현재 페이지 또는 페이지에서 표시 하는 리디렉션 DestinationPageUrl.

적용 대상

추가 정보