WebContext 构造函数

定义

初始化 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)

参数

site
String

网站的名称。

applicationPath
String

当前 Web 应用程序的根级别的虚拟路径。

path
String

当前配置对象表示的 Web.config 文件的虚拟路径。

locationSubPath
String

当前正在编辑的 location 元素的路径值。

appConfigPath
String

当前 Web 应用程序的配置路径。

示例

以下示例演示如何使用此构造函数。 该代码示例是 WebContext 类中的一个较大示例的一部分。

// Get the context.
WebContext webContext = (WebContext)config.EvaluationContext.HostingContext;
' Get the context.
Dim webContext As WebContext = config.EvaluationContext.HostingContext

适用于