ModuleService.Context 属性

定义

获取模块服务的管理上下文。

public:
 property Microsoft::Web::Management::Server::IManagementContext ^ Context { Microsoft::Web::Management::Server::IManagementContext ^ get(); };
public Microsoft.Web.Management.Server.IManagementContext Context { get; }
member this.Context : Microsoft.Web.Management.Server.IManagementContext
Public ReadOnly Property Context As IManagementContext

属性值

一个 IManagementContext 接口。

示例

以下示例使用 Context 属性获取有关客户端和当前用户的信息,然后将该信息写入跟踪输出。

public void TraceContext() {

    Trace.WriteLine("Context.ClientClrVersion : " + Context.ClientClrVersion +
        "\n IsLocalConnection " + Context.IsLocalConnection.ToString() +
        "\n User.Identity.AuthenticationType " +
        Context.User.Identity.AuthenticationType.ToString() +
        "\n User.IsInRole(Administrator) " +
        Context.User.IsInRole(WindowsBuiltInRole.Administrator.ToString()).ToString());
}

适用于