I have the following controller method.
public ActionResult Save(IEnumerable<Model> models) { try { SaveModels(models); } catch (ApplicationException ex) { return new HttpStatusCodeResult(500, "error"); } return new EmptyResult(); }
This will always return "Internal Server Error" as a description of the HTTP status, no matter what message I pass to the constructor.
Fiddler Output:
HTTP/1.1 500 Internal Server Error Server: ASP.NET Development Server/10.0.0.0 Date: Tue, 12 Apr 2011 12:44:09 GMT X-AspNet-Version: 4.0.30319 X-AspNetMvc-Version: 3.0 Cache-Control: private Content-Length: 0 Connection: Close
If I change the status code to 501, I get Not implemented by wire, the same with 200 OK. And if I select a non-existent status code, for example 535, it will simply return the status code without any description. I do not see that I am doing something wrong in accordance with the documentation and examples that I found with other people using this.
Can anyone see what I'm doing wrong?
source share