Convert HttpRequestMessage to HttpRequest

前端 未结 2 1988
借酒劲吻你
借酒劲吻你 2021-02-12 17:57

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 HttpReques

相关标签:
2条回答
  • 2021-02-12 18:17

    Try to use/create a HttpRequestWrapper using your HttpRequestBase.

    0 讨论(0)
  • 2021-02-12 18:26

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

    var context = new HttpContextWrapper(HttpContext.Current);
    HttpRequestBase request = context.Request;
    
    0 讨论(0)
提交回复
热议问题