Wenn URL
http://localhost:54027/test1/test2/home
Es zeigt Startseite
Wenn URL
http://localhost:54027/test1/test2/
Es zeigt leere Seite
Im Folgenden sind die Routen wir verwendet habenMap URL zu leere Route in ASP.NET MVC 2 von URL. URL zeigt leere Seite
routes.MapRoute(
"HomePage",
"Test2",
new { controller = "Home", action = "Index", id = "", title = UrlParameter.Optional }
);
routes.MapRoute(
"ProductDetails", // Route name
"Test2/", // URL with parameters
new { controller = "Home", action = "Index", id = "", title = UrlParameter.Optional } // Parameter defaults
);
routes.MapRoute(
"Default",
"Test2/{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = "1" }
);
Wenn wir URL versuchen folgende es funktioniert gut
http://localhost:54027/test1/test2/'
routes.MapRoute(
"ProductDetails", // Route name
"Test2/{'}", // URL with *** ' *** parameters
new { controller = "Home", action = "Index", id = "", title = UrlParameter.Optional } // Parameter defaults
);