HttpRequest.IsAuthenticated 속성

정의

요청이 인증되었는지 여부를 나타내는 값을 가져옵니다.

public:
 property bool IsAuthenticated { bool get(); };
public bool IsAuthenticated { get; }
member this.IsAuthenticated : bool
Public ReadOnly Property IsAuthenticated As Boolean

속성 값

Boolean

요청이 인증되었으면 true이고, 그렇지 않으면 false입니다.

예제

다음 코드 예제에서는 속성을 사용하여 IsAuthenticated 현재 요청이 인증되었는지 여부를 확인합니다. 이 인증 되지 않은, 경우는 요청은 사용자가 웹 애플리케이션에 자격 증명을 입력할 수 있는 다른 페이지로 리디렉션됩니다. 이것이 애플리케이션에 대 한 기본 페이지에서 사용 하는 일반적인 기술입니다.

private void Page_Load(object sender, EventArgs e)
{
    // Check whether the current request has been
    // authenticated. If it has not, redirect the 
    // user to the Login.aspx page.
    if (!Request.IsAuthenticated)
    {
        Response.Redirect("Login.aspx");
    }
}
Private Sub Page_Load(sender As Object, e As EventArgs)
    ' Check whether the current request has been
    ' authenticated. If it has not, redirect the 
    ' user to the Login.aspx page.
    If (Request.IsAuthenticated = False) Then
        Response.Redirect("Login.aspx")
    End If
End Sub

적용 대상