Ich habe Probleme, die Standardroute in MVC5 zu verstehen. Ich habe diesen Code in den RouteConfig.csSo richten Sie die Standardroute in MVC5 ein
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Content",
url: "content/{action}",
defaults: new { controller = "Content", action = "Index" }
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
Datei Als ich nach www.mydomain.com/content/index
gehe es funktioniert gut. Wenn ich jedoch auf www.mydomain/content
gehe, erhalte ich einen Fehler 403.14 verboten. Ich verstehe, dass dies eine neue Frage ist, aber was fehlt mir? Sollte es nicht zum Index-Controller Standard sein?
Haben Sie einen physischen Inhaltsordner auf der Website? Ich hatte dieses Problem, weil ich einen passenden physischen Stammordner hatte, der mit einem Controller übereinstimmte. – Nkosi
Siehe http://StackOverflow.com/A/24533925/1625737 – haim770
@ haim770 Sie sollten das als Antwort hinzufügen, da es eine Lösung für das OP bietet. Ich hatte diese Option als mögliche Lösung übersehen. – Nkosi