HttpRequest.IsAuthenticated プロパティとは何? わかりやすく解説 Weblio辞書 (original) (raw)

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

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

Visual Basic (宣言)

Public ReadOnly Property IsAuthenticated As Boolean

Visual Basic (使用法)

Dim instance As HttpRequest Dim value As Boolean

value = instance.IsAuthenticated

C#

public bool IsAuthenticated { get; }

C++

public: property bool IsAuthenticated { bool get (); }

J#

/** @property */ public boolean get_IsAuthenticated ()

JScript

public function get IsAuthenticated () : boolean

プロパティ
要求認証されている場合は **true**。それ以外場合は **false**。

使用例使用例

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

Visual Basic

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

C#

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 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

開発プラットフォーム中には.NET Framework によってサポートされていないバージョンありますサポートされているバージョンについては、「システム要件」を参照してください

バージョン情報バージョン情報

.NET Framework
サポート対象 : 2.01.11.0

参照参照

関連項目
HttpRequest クラス
HttpRequest メンバ
System.Web 名前空間