Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在将一个简单的应用程序从 ASP.NET MVC 移植到 WebForms,我应该将一个实例传递HttpRequestBase给一个方法,但我只找到 的实例,它作为类的HttpRequest属性公开。RequestPage
HttpRequestBase
HttpRequest
Request
Page
如何HttpRequestBase从 a中获取实例System.Web.UI.Page?这甚至可能吗?
System.Web.UI.Page
您可以使用HttpRequestWrapper将转换HttpRequest为 HttpRequestBase 的实例。
HttpRequestWrapper
var httpRequestBase = new HttpRequestWrapper(HttpRequest);
MSDN 参考手册