public override void OnException(ExceptionContext context) { var unhandledExceptionDTO = _exceptionService.GetUnhandledExceptionDTO(context.RouteData, context.Exception); //Log undhandled exception DTO _logger.Error(unhandledExceptionDTO); //Construct the service reponse var serviceResponse = new ServiceResponse <UnhandledExceptionDTO>(false, "Unhandled Exception details:", unhandledExceptionDTO); //What i noticed during my testing if i set ExceptionHandled to true it is setting 200 response code. //So making it false.<see>https://github.com/aspnet/Mvc/issues/5594</see> there is discussion on this. context.ExceptionHandled = false; context.HttpContext.Response.Clear(); //Assuming unhandled once are InteralServerErrors var objectResult = new ObjectResult(serviceResponse); objectResult.ContentTypes.Add(new MediaTypeHeaderValue("application/json")); objectResult.StatusCode = (int)HttpStatusCode.InternalServerError; context.Result = objectResult; }