Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I access the request as HttpRequestBase in ASP.NET WebForms?

I'm porting a simple application from ASP.NET MVC to WebForms and I am supposed to pass a instance of HttpRequestBase to a method, but I'm only finding the instance of HttpRequest, which is exposed as the property Request from the Page class.

How can I get an instance of HttpRequestBase from a System.Web.UI.Page? Is that even possible?

like image 670
André Pena Avatar asked Jul 28 '13 13:07

André Pena


1 Answers

You can use the HttpRequestWrapper instance which will convert from HttpRequest to HttpRequestBase.

var httpRequestBase = new HttpRequestWrapper(HttpRequest);

MSDN Reference Manual

like image 64
Smaug Avatar answered Nov 10 '22 17:11

Smaug