Reputation: 457
I am using Unity as my IoC for my .NET Framework 4.7.2 web application. I need to inject HttpContext. How can I do that?
Upvotes: 1
Views: 4867
Reputation: 69260
As you've tagged this as asp.net
I assume you mean Asp.Net Classic and not Asp.Net Core.
Asp.Net was written without consideration to dependency Injection. Instead, it relies on dependency resolution through thread local/execution context aware storage. So you should be able to access the current HttpContext
from anywhere using HttpContext.Current
.
Upvotes: 2