【发布时间】:2011-01-05 08:00:30
【问题描述】:
如果网址是
http://localhost:54027/test1/test2/home
它显示主页
如果网址是
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
);
【问题讨论】:
标签: asp.net-mvc asp.net-mvc-2 routes url-routing maproute