views:

59

answers:

1

I am just starting to learn ASP.NET MVC and I have a situation where I have two URLs which I would like to point to the same view.

For example I could have http://some.domain/reports/daily/team1 and http://some.domain/team1/reports/daily. Could I then point them to the same view as the request is obviously the same?

The reason I am asking this is because people are forever typing the directories in the wrong order and it would be nice to pick them up rather than dump them at the 404 page.

+3  A: 

Yes you can. Add another one of these.

routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);

Just fill in the URL part with what you want to do or rearrange the {} parts.

Daniel A. White