Andre Pena
Andre Pena

Reputation: 59416

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?

Upvotes: 5

Views: 2120

Answers (1)

Smaug
Smaug

Reputation: 2673

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

var httpRequestBase = new HttpRequestWrapper(HttpRequest);

MSDN Reference Manual

Upvotes: 10

Related Questions