Ich habe einige Probleme mit der ASP-Routing-Engine, die Probleme sind selbst ziemlich selbsterklärend.ASP.NET MVC 5 Routing-Konfiguration überprüft nicht zugewiesenen Ordner?
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "GameGold",
url: "Products/GameGold/{controller}/{action}/{id}",
defaults: new { controller = "Coins", action = "Index", id = UrlParameter.Optional }
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
Und wenn ich auf die URL localhost/Produkte/GameGold/Coins/das ist, was erscheint.
The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/Coins/Index.aspx
~/Views/Coins/Index.ascx
~/Views/Shared/Index.aspx
~/Views/Shared/Index.ascx
~/Views/Coins/Index.cshtml
~/Views/Coins/Index.vbhtml
~/Views/Shared/Index.cshtml
~/Views/Shared/Index.vbhtml
Ich habe meine Ordner wie diese
/Views/Products/GameGold/Coins/Index.cshtml
Bitte beachten Sie, dass der Model-View-Controller-Tag für Fragen über das Muster. Es gibt ein bestimmtes Tag für die ASP.NET-MVC-Implementierung. –