title: Content of HttpResponseMessage as JSON
body: <p>I have an ASP.NET MVC WEB API. For several reasons (redirect because of no authorizations ..), I can't just use a simple object and return it in my controller method. Therefore I need the HttpResponseMessage class which allows me to redirect. </p>
  
  <p>Currently I'm doing this:</p>
  
  <pre><code>var response = new Response { responseCode = Response.ResponseCodes.ItemNotFound };
  var formatter = new JsonMediaTypeFormatter();
  response.Content = new ObjectContent&lt;Response&gt;(response, formatter, "application/json");
  </code></pre>
  
  <p>.. to get the object, serialized as JSON, into the content of HttpResponseMessage. Somehow, I have the feeling that there is another, better, way to do this. Any ideas on that? </p>