Redirect() call ignores the name with which "old" rout is being registered in passed Func. Instead it takes just the result Route and calls routes.Add((RouteBase) redirectRoute); (without name argument).
This leads to situation that if some page contains @Url.RouteUrl("name"...) link, it fails to render due to absense of named route.
PS: I need many routes to be redirected to home page, so I have code like
var homePage = routes.MapRoute(...);
routes.Redirect(...).To(homePage);
routes.Redirect(...).To(homePage);
...
I would like to avoid registering each of the deleted routes separately since it looks redundant...
Redirect() call ignores the name with which "old" rout is being registered in passed Func. Instead it takes just the result Route and calls routes.Add((RouteBase) redirectRoute); (without name argument).
This leads to situation that if some page contains @Url.RouteUrl("name"...) link, it fails to render due to absense of named route.
PS: I need many routes to be redirected to home page, so I have code like var homePage = routes.MapRoute(...); routes.Redirect(...).To(homePage); routes.Redirect(...).To(homePage); ...
I would like to avoid registering each of the deleted routes separately since it looks redundant...