I have a controller call DefaultController. Inside this controller i have views for what would be the equivalent of static pages.
The URLs look like http://www.site.com/Default/PageName
Is it possible to create a route that would format these URL like:
I want to avoid creating controllers for each of these. An alternative would be to create .aspx pages in the root but can i create routes for these pages ie:
http://www.site.com/PageName.aspx becomes http://www.site.com/PageName ?
Thanks!
You can create explicit route for the
PageNameaction on theDefaultControllerlike this:You have to put this route before the default MVC route. The biggest drawback for this approach is that you have to create one route per static page.
An alternative approach would be to add an additional route after the default MVC route:
The drawback for this approach is that this rule would be handling all the URLs, even those that would normally return 404.