次の方法で共有


HttpContext.Server プロパティ

Web 要求の処理で使用されるメソッドを提供する HttpServerUtility オブジェクトを取得します。

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

構文

'宣言
Public ReadOnly Property Server As HttpServerUtility
'使用
Dim instance As HttpContext
Dim value As HttpServerUtility

value = instance.Server
public HttpServerUtility Server { get; }
public:
property HttpServerUtility^ Server {
    HttpServerUtility^ get ();
}
/** @property */
public HttpServerUtility get_Server ()
public function get Server () : HttpServerUtility
適用できません。

プロパティ値

現在の HTTP 応答に対する HttpServerUtility

解説

Server プロパティを使用すると、HttpServerUtility クラスのプロパティとメソッドにプログラムからアクセスできます。ASP.NET ページは HttpContext クラスを含んでいる System.Web 名前空間への既定の参照を含んでいるため、.aspx ページでは、HttpContext への完全限定クラス参照を省略しても、HttpContext のメンバを参照できます。たとえば、Server.CreateObject("MyCOMComponent") を使用するだけで、サーバー上に COM オブジェクトのインスタンスを作成できます。ただし、ASP.NET 分離コード モジュールから HttpServerUtility のメンバを使用する場合は、モジュールに System.Web 名前空間への参照を含める必要があります。また、現在のアクティブな要求/応答のコンテキストへの参照、および使用する System.Web のクラスへの参照は、どちらも完全修飾する必要があります。たとえば、分離コードのページでは、HttpContext.Current.Server.CreateObject("MyCOMComponent") のように完全な名前を指定する必要があります。

プラットフォーム

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

参照

関連項目

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