AI OnAI Off
did you check IIS friendly error message feature? that one should be turned off for the best experience here...
I know this happens when you have your custom error page enabled globally. I would say try something like this to filter the API based error messages different from global errors.
<!-- Override it for paths starting with api (your WebAPI) -->
<location path="api">
<system.web>
<customErrors mode="Off" />
</system.web>
</location>
Note, you can continue to use your global custom errors as you prefer. E.g.
<!-- General for the application -->
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="YourCustomErrorPage.aspx"/>
</system.web>
Hope this works. Please update how it goes.
~ Sujit
I have implemented WebAPI in my EPiServer solution. I am having trouble with error handling. I would like my errors to return as some JSON along with the correct status code. No matter what I do, error sare returning an HTML error page. I have gon through a whole bunch of different options. This is what I think I need to do:
But this still returns an HTML error page: