Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect routes are registered without name, so @Url.RouteUrl("name"...) fail #22

Open
spshenychnyy-mechanicadvisor opened this issue Oct 23, 2019 · 0 comments

Comments

@spshenychnyy-mechanicadvisor
Copy link

spshenychnyy-mechanicadvisor commented Oct 23, 2019

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant