I'm using ASP.NET 4.0 Web Forms with master pages. I have the following routing rule in my Global.asax.cs file:
routes.MapPageRoute("", "Ministries", "~/Ministries/Ministries.aspx");
It works fine when I alter the rule above to display the content page from the root. When I navigate to the page using http://localhost/church/ministries the page displays the directory view. What am I missing?
Give the route a name and change your folder name since the route and folder names collide.
routes.MapPageRoute("ministries", "Ministries", "~/Ministry/Ministries.aspx");
and you must navigate to it like this (from an asp:linkbutton example, use whatever)
NavigateUrl="<%$RouteUrl:RouteName=ministries %>"
Just hardcoding the path does not send it through asp's routing engine, you were pointing it to the directory, it does not know any better.