I have the following MapRoute which works and routes to the controller 'Hotel'
routes.MapRoute("Hotel", "en/hotels/london/victoria/my_hotel_name/",
new { controller = "Hotel", action = "Index" }, namespaces: new[] { "UrlRouter.Router.Controllers" } );
However, if the user enters filename index.asp in the path it doesn't route to the controller and just loads the actual content in the .ASP file, which is what I don't want. I want it to route to the controller, so I can control what is returned to the user.
The route I tried was
routes.MapRoute("Hotel", "en/hotels/london/victoria/my_hotel_name/index.asp",
new { controller = "Hotel", action = "Index" }, namespaces: new[] { "UrlRouter.Router.Controllers" } );
After further investigation, I found the following works. Add in web.config
Then in Register routes
This allows me to route both these URLs to my Hotel controller and return a MVC view
and
If anyone has a better suggestion please post your answer.