HttpRequest.IsAuthenticated プロパティ

要求が認証されているかどうかを示す値を取得します。

名前空間: System.Web
アセンブリ: System.Web (system.web.dll 内)

構文

'宣言
Public ReadOnly Property IsAuthenticated As Boolean
'使用
Dim instance As HttpRequest
Dim value As Boolean

value = instance.IsAuthenticated
public bool IsAuthenticated { get; }
public:
property bool IsAuthenticated {
    bool get ();
}
/** @property */
public boolean get_IsAuthenticated ()
public function get IsAuthenticated () : boolean
適用できません。

プロパティ値

要求が認証されている場合は true。それ以外の場合は false

使用例

IsAuthenticated プロパティを使用して、現在の要求が認証されているかどうかを確認するコード例を次に示します。認証されていない場合、その要求は、ユーザーが自分の資格情報を Web アプリケーションに入力できる別のページにリダイレクトされます。これは、アプリケーションの既定のページで使用される一般的な手法です。

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
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");
    }
}

プラットフォーム

Windows 98,Windows Server 2000 SP4,Windows CE,Windows Millennium Edition,Windows Mobile for Pocket PC,Windows Mobile for Smartphone,Windows Server 2003,Windows XP Media Center Edition,Windows XP Professional x64 Edition,Windows XP SP2,Windows XP Starter Edition

Microsoft .NET Framework 3.0 は Windows Vista,Microsoft Windows XP SP2,および Windows Server 2003 SP1 でサポートされています。

バージョン情報

.NET Framework

サポート対象 : 3.0,2.0,1.1,1.0

参照

関連項目

HttpRequest クラス
HttpRequest メンバ
System.Web 名前空間