I've got a situation where most of the requests will be processed with dedicated controllers.
config.Routes.MapHttpRoute(
name: "DataApi",
routeTemplate: "api/{controller}/{action}",
defaults: new
{
controller = "default"
}
);
But there may be a situation where no controller will be found based on URL. Like api/this_controller_is_not_exists/GetStatus.
How can I redirect those requests to default controller called default and process this request using action inside default controller?
Valid requests for default controller would look like api/default/GetStatus.
The route will be no much different for valid and invalid request. Valid:
'api/this_controller_exist/GetStatus'
Invalid:
'api/this_controller_not_exists/GetStatus'