[英]How to have a common HttpContext for ASP.NET WebForms, MVC and CORE
I'm working on a Nuget library which can be used for web applications (WebForms, MVC, CORE) and will be published for both .NetFramework and .NetStandard.我正在开发一个 Nuget 库,该库可用于 Web 应用程序(WebForms、MVC、CORE),并将为 .NetFramework 和 .NetStandard 发布。
In my library I need to access the HttpContext for reading the Request and also for redirecting and writing in the Response object.在我的库中,我需要访问 HttpContext 以读取请求以及重定向和写入响应对象。
What's the best way to have a common HttpContext for all three frameworks WebForms, MVC and CORE?为所有三个框架 WebForms、MVC 和 CORE 拥有通用 HttpContext 的最佳方法是什么?
Note that Microsoft.Owin is not compatible with .NetStandard and also in WebForms and MVC there is a System.Web.HttpContextBase class which is completely different in .NETCore projects and there we have Microsoft.AspNetCore.Http.HttpContext.请注意,Microsoft.Owin 与 .NetStandard 不兼容,而且在 WebForms 和 MVC 中有一个 System.Web.HttpContextBase 类,它在 .NETCore 项目中完全不同,我们有 Microsoft.AspNetCore.Http.HttpContext。
Your library could be organized this way:你的图书馆可以这样组织:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.