I use custom action filter in asp.net mvc app to return http status code 422 and json list of validation errors (basically serialized model state dictionary) to client, where I handle that with global ajaxError handler in jQuery.
All of this works on development enviroment, but my problem is when custom errors mode is on (<system.webServer>/<httpErrors errorMode="Custom">
), IIS replaces response (json) with text "The custom error module does not recognize this error."
I'm having hard time properly configuring IIS to pass-through original response if status code is 422. Anyone did something similar?
If web server is configured to pass through existing response, it will return json contents to browser.
<system.webServer>
<httpErrors errorMode="DetailedLocalOnly" existingResponse="PassThrough">
</httpErrors>
</system.webServer>