在我的应用程序中,有些控制器使用特定的路由,有些则使用默认路由。因此,我有这样的想法:
//.. other more specific routes
routes.MapRoute(
"Workout - Specific Workouts by exercise",
"{userName}/workouts/exercise/{exerciseID}/{exerciseName}",
new { controller = "Workout", action = "WorkoutsByExercise" }
);
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = "" }
);
routes.MapRoute(
"Error",
"{*catchall}",
new { controller = "Error", action = "Http404" }
);
但是,如果我键入一些类似于/home/SuntWordNoTistor的东西,它将被默认路由器拾取,因此永远不会到达我的C驱赶路由处理程序。我已经通过Phil Haack的路由调试器验证了这一点。因此,它将尝试到达该控制器/操作,但找不到它。作为回报,structuremap抛出了一个错误,这个错误会冒泡到application_error,而我无法重定向它(尽管我已经尝试了所有的方法并进行了研究)。
所以,这附近是否还有其他路线,或者我必须为
全部的
如何在进入application_error()后重定向到特定页/控制器?