c# - Conditionally override all routes (MVC / ASP) -
i have asp.net mvc website connects db via web service.
if webservice not contactable, want redirect user page explaining service isn't running. crashes when webservice doesnt respond properly.
what best method achieve this? have lots of controllers writing error trapping code each function in each controller specific case tedious , involve lot of code repeation.
one easy option write base-controller; override methods want (whether before call (onactionexecuting
) or upon exception (onexception
)), , add : mybasecontroller
each controller.
another option decorate each controller filter-attribute same work.
Comments
Post a Comment