WebContext 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化 WebContext 類別的新執行個體。
public:
WebContext(System::Web::Configuration::WebApplicationLevel pathLevel, System::String ^ site, System::String ^ applicationPath, System::String ^ path, System::String ^ locationSubPath, System::String ^ appConfigPath);
public WebContext(System.Web.Configuration.WebApplicationLevel pathLevel, string site, string applicationPath, string path, string locationSubPath, string appConfigPath);
new System.Web.Configuration.WebContext : System.Web.Configuration.WebApplicationLevel * string * string * string * string * string -> System.Web.Configuration.WebContext
Public Sub New (pathLevel As WebApplicationLevel, site As String, applicationPath As String, path As String, locationSubPath As String, appConfigPath As String)
參數
- pathLevel
- WebApplicationLevel
- site
- String
網站名稱。
- applicationPath
- String
目前網頁應用程式根層的虛擬路徑。
- path
- String
目前設定物件所代表的 Web.config 檔案的虛擬路徑。
- locationSubPath
- String
目前正在編輯的元素的 location 路徑值。
- appConfigPath
- String
目前網頁應用程式的設定路徑。
範例
以下範例說明如何使用此建構子。 此程式碼範例是本類別更大範例 WebContext 的一部分。
// Get the context.
WebContext webContext = (WebContext)config.EvaluationContext.HostingContext;
' Get the context.
Dim webContext As WebContext = config.EvaluationContext.HostingContext