如果 URL 是
http://localhost:54027/test1/test2/home
它显示主页
如果 URL 是
http://localhost:54027/test1/test2/
它显示空白页面
以下是我们使用的路由
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" }
);
如果我们尝试以下 URL,它可以正常工作
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
);