HttpRuntime クラス
アセンブリ: System.Web (system.web.dll 内)


HttpRuntime オブジェクトは、HTTP 要求を処理する ASP.NET パイプライン モデルで最初に使用されます。ProcessRequest メソッドは、後続のすべての ASP.NET Web 処理を制御します。
ページを開発する場合、HttpRuntime クラス プロパティを使用して、診断などの目的で、現在のアプリケーション ドメインに関する情報を確認できます。カスタム プロセス パイプラインまたはカスタム ホスト環境を作成する場合は、ProcessRequest メソッドを HttpWorkerRequest クラスまたは SimpleWorkerRequest クラスの派生クラスから呼び出す必要があります。

現在のアプリケーション ドメインを表す、HttpRuntime クラスのプロパティを取得して、それをブラウザに表示する方法を次のコード例に示します。
<%@ Page Language="VB" %> <script runat="server"> Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Dim sb As New StringBuilder() Dim nl As String = "<br>" sb.Append("AppDomainAppId = " & _ HttpRuntime.AppDomainAppId & nl) sb.Append("AppDomainAppPath = " & _ HttpRuntime.AppDomainAppPath & nl) sb.Append("AppDomainAppVirtualPath = " & _ HttpRuntime.AppDomainAppVirtualPath & nl) sb.Append("AppDomainId = " & _ HttpRuntime.AppDomainId & nl) sb.Append("AspInstallDirectory = " & _ HttpRuntime.AspInstallDirectory & nl) sb.Append("BinDirectory = " & _ HttpRuntime.BinDirectory & nl) sb.Append("ClrInstallDirectory = " & _ HttpRuntime.ClrInstallDirectory & nl) sb.Append("CodegenDir = " & _ HttpRuntime.CodegenDir & nl) sb.Append("IsOnUNCShare = " & _ HttpRuntime.IsOnUNCShare.ToString() & nl) sb.Append("MachineConfigurationDirectory = " & _ HttpRuntime.MachineConfigurationDirectory & nl) label1.Text = sb.ToString() End Sub </script> <html> <head> <title>HttpRuntime Example</title> </head> <body> <form id="Form1" runat="server"> <asp:label id="label1" runat="server"/> </form> </body> </html>
<%@ Page Language="C#" %> <script runat="server"> void Page_Load(Object sender, System.EventArgs e) { StringBuilder sb = new StringBuilder(); String nl = "<br>"; sb.Append("AppDomainAppId = " + HttpRuntime.AppDomainAppId + nl); sb.Append("AppDomainAppPath = " + HttpRuntime.AppDomainAppPath + nl); sb.Append("AppDomainAppVirtualPath = " + HttpRuntime.AppDomainAppVirtualPath + nl); sb.Append("AppDomainId = " + HttpRuntime.AppDomainId + nl); sb.Append("AspInstallDirectory = " + HttpRuntime.AspInstallDirectory + nl); sb.Append("BinDirectory = " + HttpRuntime.BinDirectory + nl); sb.Append("ClrInstallDirectory = " + HttpRuntime.ClrInstallDirectory + nl); sb.Append("CodegenDir = " + HttpRuntime.CodegenDir + nl); sb.Append("IsOnUNCShare = " + HttpRuntime.IsOnUNCShare.ToString() + nl); sb.Append("MachineConfigurationDirectory = " + HttpRuntime.MachineConfigurationDirectory + nl); label1.Text = sb.ToString(); } </script> <html> <head> <title>HttpRuntime Example</title> </head> <body> <form runat="server"> <asp:label id="label1" runat="server"/> </form> </body> </html>
<%@ Page Language="VJ#"%> <script runat="server"> void Page_Load(Object sender, System.EventArgs e) { StringBuilder sb = new StringBuilder(); String nl = "<br>"; sb.Append("AppDomainAppId = " + HttpRuntime.get_AppDomainAppId() + nl); sb.Append("AppDomainAppPath = " + HttpRuntime.get_AppDomainAppPath() + nl); sb.Append("AppDomainAppVirtualPath = " + HttpRuntime.get_AppDomainAppVirtualPath() + nl); sb.Append("AppDomainId = " + HttpRuntime.get_AppDomainId() + nl); sb.Append("AspInstallDirectory = " + HttpRuntime.get_AspInstallDirectory() + nl); sb.Append("BinDirectory = " + HttpRuntime.get_BinDirectory() + nl); sb.Append("ClrInstallDirectory = " + HttpRuntime.get_ClrInstallDirectory() + nl); sb.Append("CodegenDir = " + HttpRuntime.get_CodegenDir() + nl); sb.Append("IsOnUNCShare = " + Convert.ToString(HttpRuntime.get_IsOnUNCShare()) + nl); sb.Append("MachineConfigurationDirectory = " + HttpRuntime.get_MachineConfigurationDirectory() + nl); label1.set_Text(sb.ToString()); } </script> <html> <head> <title>HttpRuntime Example</title> </head> <body> <form id="Form1" runat="server"> <asp:label id="label1" runat="server"/> </form> </body> </html>


System.Web.HttpRuntime


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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


HttpRuntime メンバ
System.Web 名前空間
ProcessRequest
HttpWorkerRequest
SimpleWorkerRequest
その他の技術情報
ASP.NET Web アプリケーションのページとアプリケーション コンテキスト
HttpRuntime コンストラクタ
アセンブリ: System.Web (system.web.dll 内)


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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


HttpRuntime プロパティ

名前 | 説明 | |
---|---|---|
![]() | AppDomainAppId | HttpRuntime が存在するアプリケーション ドメインのアプリケーション ID を取得します。 |
![]() | AppDomainAppPath | 現在のアプリケーション ドメインでホストされるアプリケーションのアプリケーション ディレクトリの物理ドライブ パスを取得します。 |
![]() | AppDomainAppVirtualPath | 現在のアプリケーション ドメインでホストされる、アプリケーションを格納するディレクトリの仮想パスを取得します。 |
![]() | AppDomainId | HttpRuntime が存在するアプリケーション ドメインのアプリケーション ID を取得します。 |
![]() | AspClientScriptPhysicalPath | ASP.NET クライアント スクリプト ファイルのフォルダ パスを取得します。 |
![]() | AspClientScriptVirtualPath | ASP.NET クライアント スクリプト ファイルの仮想パスを取得します。 |
![]() | AspInstallDirectory | ASP.NET 実行可能ファイルがインストールされているディレクトリの物理パスを取得します。 |
![]() | BinDirectory | 現在のアプリケーションの /bin ディレクトリへの物理パスを取得します。 |
![]() | Cache | 現在のアプリケーションに対する Cache を取得します。 |
![]() | ClrInstallDirectory | 共通言語ランタイムの実行可能ファイルをインストールするディレクトリを表す物理パスを取得します。 |
![]() | CodegenDir | 生成されたソース、コンパイルされたアセンブリなどの現在のアプリケーションの一時ファイルを ASP.NET で格納する場合に使用する、ディレクトリを表す物理パスを取得します。 |
![]() | IsOnUNCShare | アプリケーションを UNC (universal naming convention) 共有に割り当てるかどうかを示す値を取得します。 |
![]() | MachineConfigurationDirectory | 現在のアプリケーションの Machine.config ファイルを格納するディレクトリを表す物理パスを取得します。 |

関連項目
HttpRuntime クラスSystem.Web 名前空間
ProcessRequest
HttpWorkerRequest
SimpleWorkerRequest
その他の技術情報
ASP.NET Web アプリケーションのページとアプリケーション コンテキストHttpRuntime メソッド

名前 | 説明 | |
---|---|---|
![]() | Close | キャッシュからすべての項目を削除します。 |
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | ProcessRequest | すべての ASP.NET Web 処理の実行を制御します。 |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |
![]() | UnloadAppDomain | 現在のアプリケーションを終了します。アプリケーションに対する要求を次回受信したとき、アプリケーションは再起動されます。 |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

関連項目
HttpRuntime クラスSystem.Web 名前空間
ProcessRequest
HttpWorkerRequest
SimpleWorkerRequest
その他の技術情報
ASP.NET Web アプリケーションのページとアプリケーション コンテキストHttpRuntime メンバ
現在のアプリケーションに ASP.NET ランタイム サービスのセットを提供します。
HttpRuntime データ型で公開されるメンバを以下の表に示します。


名前 | 説明 | |
---|---|---|
![]() | AppDomainAppId | HttpRuntime が存在するアプリケーション ドメインのアプリケーション ID を取得します。 |
![]() | AppDomainAppPath | 現在のアプリケーション ドメインでホストされるアプリケーションのアプリケーション ディレクトリの物理ドライブ パスを取得します。 |
![]() | AppDomainAppVirtualPath | 現在のアプリケーション ドメインでホストされる、アプリケーションを格納するディレクトリの仮想パスを取得します。 |
![]() | AppDomainId | HttpRuntime が存在するアプリケーション ドメインのアプリケーション ID を取得します。 |
![]() | AspClientScriptPhysicalPath | ASP.NET クライアント スクリプト ファイルのフォルダ パスを取得します。 |
![]() | AspClientScriptVirtualPath | ASP.NET クライアント スクリプト ファイルの仮想パスを取得します。 |
![]() | AspInstallDirectory | ASP.NET 実行可能ファイルがインストールされているディレクトリの物理パスを取得します。 |
![]() | BinDirectory | 現在のアプリケーションの /bin ディレクトリへの物理パスを取得します。 |
![]() | Cache | 現在のアプリケーションに対する Cache を取得します。 |
![]() | ClrInstallDirectory | 共通言語ランタイムの実行可能ファイルをインストールするディレクトリを表す物理パスを取得します。 |
![]() | CodegenDir | 生成されたソース、コンパイルされたアセンブリなどの現在のアプリケーションの一時ファイルを ASP.NET で格納する場合に使用する、ディレクトリを表す物理パスを取得します。 |
![]() | IsOnUNCShare | アプリケーションを UNC (universal naming convention) 共有に割り当てるかどうかを示す値を取得します。 |
![]() | MachineConfigurationDirectory | 現在のアプリケーションの Machine.config ファイルを格納するディレクトリを表す物理パスを取得します。 |

名前 | 説明 | |
---|---|---|
![]() | Close | キャッシュからすべての項目を削除します。 |
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | ProcessRequest | すべての ASP.NET Web 処理の実行を制御します。 |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |
![]() | UnloadAppDomain | 現在のアプリケーションを終了します。アプリケーションに対する要求を次回受信したとき、アプリケーションは再起動されます。 |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

関連項目
HttpRuntime クラスSystem.Web 名前空間
ProcessRequest
HttpWorkerRequest
SimpleWorkerRequest
その他の技術情報
ASP.NET Web アプリケーションのページとアプリケーション コンテキストWeblioに収録されているすべての辞書からHttpRuntimeを検索する場合は、下記のリンクをクリックしてください。

- HttpRuntimeのページへのリンク