I am trying to route a link in MVC project.
I tried two methods:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
//method1
// routes.MapPageRoute("SchoolPage", "School", "~/home", false);
//method2
routes.MapRoute(name: "SchoolPage",url: "School", defaults: new { controller = "Home", action = "Index" });
}
For both methods I get the error:
HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.