asp.net mvc - MVC5 Cannot return custom 404 error with JsonResult -


i cannot return custom json result below when publish mvc5+angular2 project iis. return default iis 404 error html.

response.statuscode = 404; return json(myerrorobject, jsonrequestbehavior.allowget); 

everything works fine whil developing project using iis express.

thanks.

if want return json custom 404 or http message, need set config below;

<system.webserver>   <httperrors existingresponse="passthrough"/> </system.webserver> 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -