Reputation: 93
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.
Upvotes: 1
Views: 62