Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HttpContextBase and System.Web in .NET Standard

I originally have code using HttpContextBase from System.Web in my ASP.NET Web MVC project.

I would like to extend this functionality to a project that is using .NET Core by moving the code into a .NET Standard Library so both projects using ASP.NET Web MVC and ASP.NET Core respectively can use it.

Is there a replacement library or method I can use instead of HttpContextBase in my .NET Standard library to share code?

like image 1000
mikeg Avatar asked Jan 01 '26 08:01

mikeg


1 Answers

Check out Microsoft.AspNetCore.SystemWebAdapters looks like it provides a few ways to convert between System.Web.HttpContext and Microsoft.AspNetCore.Http.HttpContext, and the surrounding docs have some additional guidance for migrating from ASP.NET to ASP.NET Core

like image 151
gordy Avatar answered Jan 02 '26 22:01

gordy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!