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 Route Not working #7

Closed
tafs7 opened this issue Aug 22, 2012 · 2 comments
Closed

Redirect Route Not working #7

tafs7 opened this issue Aug 22, 2012 · 2 comments

Comments

@tafs7
Copy link

tafs7 commented Aug 22, 2012

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?

@haacked
Copy link
Owner

haacked commented Aug 22, 2012

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

@tafs7
Copy link
Author

tafs7 commented Aug 22, 2012

ahh, but of course. silly me. thanks, phil!

@tafs7 tafs7 closed this as completed Aug 22, 2012
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

2 participants