asp.net mvc 4 - Custom errors on MVC 4 Web API before controller action is invoked -


based on this article i've implemented own exceptionfilterattribute , registered filter in globalconfiguration custom exception handling in mvc 4 web api.

however exceptionfilterattribute gets invoked exceptions thrown in controller action, after request resolved framework.

i'd implement custom error handling exceptions thrown before controller action called. example, exception thrown in delegatinghandler returns me following html:

<!doctype html> <html>     <head>         <title>exception of type 'system.exception' thrown.</title>         ... 

what need return own custom error scenario?

if delegatinghandler exceptions generated filters you've written, can add filter "trap" of these exceptions shown in answer.

as you've found out , documented in answer, limited in exceptions you'll "trap" web api pipeline. option see try you're describing write custom httpmessagehandler demonstrated in article.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -