title: Return Mvc.JsonResult plus set Response.StatusCode
body: <p>Project: ASP MVC 4 running under .net 4.0 framework:</p>
  
  <p>When running an application under VS 2010 express (or deployed and running under IIS 7.5 on my local machine) the following (pseudocode) result from an action works as expected</p>
  
  <pre><code>[HttpPost]
  public ActionResult PostWord(Model model)
  {
     ....
     Response.StatusCode = 400;
     Return new JsonResult { data = new {fieldName = "Word", error = "Not really a word!" } };
  </code></pre>
  
  <p>(and I have assigned ContentType and ContentEncoding properties of the JsonResult object, with no difference in behaviour)</p>
  
  <p>When the deployable is moved onto a web host (using IIS 7), firebug is telling me that the response is as expected (400) but there is no JSON in the response (ie there is no text of any kind). If I remove the line </p>
  
  <pre><code>Response.StatusCode = 400;
  </code></pre>
  
  <p>from the action, the JSON is perfectly formed in the response, but of course the response status code is 200 (OK), which interferes with the consuming javascript and appropriate function call.</p>
  
  <p>Any thoughts on what might be going on and how to fix this? Thank you</p>