Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert HttpRequestMessage to HttpRequest

Tags:

I'm converting ASP.NET web application to MVC Web Api project. One of my methods expects HttpRequest class. However, Web Api controller holds only HttpRequestMessage (this.Request) object. Do you know how I can convert HttpRequestMessage to HttpRequest?

like image 800
Avi L Avatar asked Apr 29 '13 06:04

Avi L


1 Answers

You probably don't need to convert from HttpRequestMessage. There is another way:

var context = new HttpContextWrapper(HttpContext.Current);
HttpRequestBase request = context.Request;
like image 164
Boris Lipschitz Avatar answered Sep 21 '22 10:09

Boris Lipschitz