'How to use GetCurrentAuditScope metthod in an ActionFilterAttribute

How to uses the GetCurrentAuditScope() (or another) method in an ActionFilterAtribbute on MVC and WebAPI to get the AuditScope.

I need recover that on OnActionExecuted(HttpActionExecutedContext actionExecutedContext) event.

Or have another thing which i can uses?



Solution 1:[1]

Yes, you can use the GetCurrentAuditScope() Extension Method on HttpContext, for example:

using Audit.WebApi;
// ...

public override void OnActionExecuted(ActionExecutedContext context)
{
    var scope = context.HttpContext.GetCurrentAuditScope();
    // ...
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 thepirat000