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 會將事件資訊提供給 GetRoles 類別的事件 RoleManagerModule 。 屬性 Context 提供目前要求的 存取 HttpContext 權。

適用於

另請參閱