Postsharp aspects reach to HttpContext

58 views Asked by At

I am using PostSharp, and within my aspects, I want to check a header from the incoming request during the entry phase of a method. I am unable to access HttpContext. Is there a way to achieve this?

var httpContextAccessor = args.Instance.GetType().GetService<IHttpContextAccessor>();

var httpContext = httpContextAccessor?.HttpContext;

I tried this, but I couldn't get any results.

0

There are 0 answers