There's a problem to your approach: .NET Standard is the most bare-bones implementation of .NET available, meaning that only basic features which are platform- and scenario-agnostic are implemented.
HttpContext
exists on both the .NET Framework and .NET Core (both of which implement .NET Standard, by the way), but being specific to the Web, it does not exist on .NET Standard.
So, you have three options:
- Target the .NET Framework and use
System.Web.HttpContext
- Target .NET Core and use
Microsoft.AspNetCore.Http.HttpContext
- Move the logic that uses
HttpContext
away from the .NET Standard project
Do notice, though, that those classes vary greatly. The .NET Core version was created for ASP.NET Core which is vastly different to ASP.NET 4.5 and olders.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…