RoleManagerEventArgs.Context 属性

定义

获取当前请求的 HttpContext

public:
 property System::Web::HttpContext ^ Context { System::Web::HttpContext ^ get(); };
public System.Web.HttpContext Context { get; }
member this.Context : System.Web.HttpContext
Public ReadOnly Property Context As HttpContext

属性值

当前请求的 HttpContext

示例

以下示例显示了 GetRoles 包含在 ASP.NET 应用程序的 Global.asax 文件中的 事件。 事件 GetRoles 为在 Web.config 文件中启用了跟踪的应用程序添加跟踪通知。

public void RoleManager_OnGetRoles(object sender, RoleManagerEventArgs args)
{
  args.Context.Trace.Write("Roles", "Applying Role Information");
}
Public Sub RoleManager_OnGetRoles(sender As Object, args As RoleManagerEventArgs)
  args.Context.Trace.Write("Roles", "Applying Role Information")
End Sub

注解

对象RoleManagerEventArgs向 类的 RoleManagerModule 事件提供事件信息GetRoles。 属性 Context 提供对 HttpContext 当前请求的 的访问。

适用于

另请参阅