Controller:
public ActionResult Update(SomeModel model)
{
if(SomethingIsWrong())
return new HttpStatusCodeResult(500, "Something Went Wrong");
return Json(model);
}
Whenever I use this, Instead of my message "Something Went Wrong", I always get "Internal Server Error" as HTTP status error received in my ajax call using jQuery. If I am on php and I send a custom error message, I retrieve perfect error message the one I sent in the same client script.
Network Trace in IE, Chrome confirms that ASP.NET sends message "Internal Server Error" even if I have set different status message.
Also, changing custom errors mode on/off in web.config made no difference either.