Redirect Route Not working
tafs7 opened this issue · comments
I have a route configured as follows:
var defaultHomeRoute = routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
MVC.Home.Index(),
defaults: new { id = UrlParameter.Optional });
routes.Redirect(
r => r.MapRoute(
"ImageReviewDisabled",
"Review/{action}"),
permanent: false).To(defaultHomeRoute);
However, when I browse to the url /Review/Index, it does not redirect me to /Home/Index, as I would expect. I'm not sure if there's anything else I need to do in order to get this to work. My intent is to prevent users from accessing the ReviewController for a while since we're re-developing, and the app is still in a testing cycle.
Am I missing any other configuration to get this temporary redirect to work?
Well the problem is that /Review/Index
matches the default home route, so the redirect route is never reached. Try adding a constraint to default route so that the controller cannot be named "Review".
ahh, but of course. silly me. thanks, phil!