title: How to set HttpResponse to HttpResponseMessage in Web API
body: <p>I have a asp.net web <code>API</code> application hosted using <code>OWIN</code>. The web <code>API</code> application uses an external library which depends on <code>System.Web</code> and writes its response on System.Web.Response object. I have set a dummy object to <code>HttpContext.Current</code> and after that the I expect the external library would set the response at <code>HttpRequest</code>. Then I need to know how I could transfer the result from <code>HttpRequest</code> to <code>HttpRequestMessage</code> so that the web <code>API</code> method could process the result. </p>
  
  <p>Here is some sample code:</p>
  
  <pre><code>public HttpResponseMessage GetTest()
  {
      HttpResponseMessage responseMessage = new HttpResponseMessage();
  
      HttpResponse httpResponse = new HttpResponse(new StreamWriter(new MemoryStream()));
      httpResponse.Write("From HttpResponse");
  
      return responseMessage;
  }
  </code></pre>
  
  <p>I have written some text using the <code>HttpResponse.Write()</code> method, now I need to move the result from <code>HttpResponse</code> to <code>HttpResponseMessage</code>.</p>