ASP.Net Core Error JSON
问题 I'm playing a bit with ASP.NET Core. I'm creating a basic webapi. I'd like to show a JSON error when there is a problem. The printscreen shows want I want on my screen. The only problem is that it's send with a statuscode of 200. catch (NullReferenceException e) { return Json(NotFound(e.Message)); } I could solve it by doing this: return NotFound(new JsonResult(e.Message) {StatusCode = 404); But I don't like this because now you can specify statuscode 500 with a NotFound. Can someone put me