HttpRequest.IsAuthenticated Özellik

Tanım

İsteğin kimliğinin doğrulanıp doğrulanmadığını belirten bir değer alır.

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

Özellik Değeri

true isteğin kimliği doğrulanmışsa; aksi takdirde , false.

Örnekler

Aşağıdaki kod örneği, geçerli isteğin IsAuthenticated kimliğinin doğrulanıp doğrulanmamış olduğunu belirlemek için özelliğini kullanır. Kimliği doğrulanmamışsa istek, kullanıcıların kimlik bilgilerini Web uygulamasına girebileceği başka bir sayfaya yönlendirilir. Bu, bir uygulama için varsayılan sayfada kullanılan yaygın bir tekniktir.

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

Şunlara uygulanır