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


WebContext クラスを使用する方法を次のコード例に示します。
Imports System Imports System.Configuration Imports System.Web Imports System.Web.Configuration Namespace Samples.Aspnet.SystemWebConfiguration Class UsingWebContext Public Shared Sub Main() Try ' Set the path of the config file. Dim configPath As String = "/aspnet" ' Get the Web application configuration object. Dim config As Configuration = _ WebConfigurationManager.OpenWebConfiguration(configPath) ' Get the context. Dim webContext As WebContext = config.EvaluationContext.HostingContext ' Display title and info. Console.WriteLine("ASP.NET WebContext Info") Console.WriteLine() ' WebContext - Application Level. Console.WriteLine("ApplicationLevel: {0}", _ webContext.ApplicationLevel.ToString()) ' WebContext - Application Path. Console.WriteLine("ApplicationPath: {0}", _ webContext.ApplicationPath.ToString()) ' WebContext - Path. Console.WriteLine("Path: {0}", webContext.Path.ToString()) ' WebContext - Site. Console.WriteLine("Site: {0}", webContext.Site.ToString()) Catch e As Exception ' Unknown error. Console.WriteLine(e.ToString()) End Try ' Display and wait Console.ReadLine() End Sub End Class End Namespace
using System; using System.Configuration; using System.Web; using System.Web.Configuration; namespace WebContextTest01cs { class UsingWebContext { static void Main(string[] args) { try { // Set the path of the config file. string configPath = "/aspnet"; // Get the Web application configuration object. Configuration config = WebConfigurationManager.OpenWebConfiguration(configPath); // Get the context. WebContext webContext = (WebContext)config.EvaluationContext.HostingContext; // Display title. Console.WriteLine("ASP.NET WebContext Info"); Console.WriteLine(""); // WebContext - Application Level. Console.WriteLine("ApplicationLevel: {0}", webContext.ApplicationLevel.ToString()); // WebContext - Application Path. Console.WriteLine("ApplicationPath: {0}", webContext.ApplicationPath.ToString()); // WebContext - Path. Console.WriteLine("Path: {0}", webContext.Path.ToString()); // WebContext - Site. Console.WriteLine("Site: {0}", webContext.Site.ToString()); } catch (Exception ex) { // Unknown error. Console.WriteLine(ex.ToString()); } // Display and wait. Console.ReadLine(); } } }

System.Web.Configuration.WebContext


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


WebContext コンストラクタ
アセンブリ: System.Web (system.web.dll 内)

Public Sub New ( _ pathLevel As WebApplicationLevel, _ site As String, _ applicationPath As String, _ path As String, _ locationSubPath As String _ )
Dim pathLevel As WebApplicationLevel Dim site As String Dim applicationPath As String Dim path As String Dim locationSubPath As String Dim instance As New WebContext(pathLevel, site, applicationPath, path, locationSubPath)
public WebContext ( WebApplicationLevel pathLevel, string site, string applicationPath, string path, string locationSubPath )
public: WebContext ( WebApplicationLevel pathLevel, String^ site, String^ applicationPath, String^ path, String^ locationSubPath )
public WebContext ( WebApplicationLevel pathLevel, String site, String applicationPath, String path, String locationSubPath )
public function WebContext ( pathLevel : WebApplicationLevel, site : String, applicationPath : String, path : String, locationSubPath : String )
- pathLevel
WebApplicationLevel オブジェクト。

WebContext コンストラクタを使用する方法を次のコード例に示します。このコード例は、WebContext クラスのトピックで取り上げているコード例の一部分です。

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


WebContext プロパティ

名前 | 説明 | |
---|---|---|
![]() | ApplicationLevel | 現在の Web アプリケーションのパス レベルを表す WebApplicationLevel オブジェクトを取得します。 |
![]() | ApplicationPath | 現在の Web アプリケーションのアプリケーション パスを取得します。 |
![]() | LocationSubPath | Web アプリケーションの場所のサブパスを取得します。 |
![]() | Path | Web アプリケーションの現在の仮想パスを取得します。 |
![]() | Site | 現在の Web アプリケーションの名前を取得します。 |

WebContext メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

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

WebContext メンバ
現在の Web アプリケーションのパス コンテキストを管理します。このクラスは継承できません。
WebContext データ型で公開されるメンバを以下の表に示します。


名前 | 説明 | |
---|---|---|
![]() | ApplicationLevel | 現在の Web アプリケーションのパス レベルを表す WebApplicationLevel オブジェクトを取得します。 |
![]() | ApplicationPath | 現在の Web アプリケーションのアプリケーション パスを取得します。 |
![]() | LocationSubPath | Web アプリケーションの場所のサブパスを取得します。 |
![]() | Path | Web アプリケーションの現在の仮想パスを取得します。 |
![]() | Site | 現在の Web アプリケーションの名前を取得します。 |

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

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

- WebContextのページへのリンク