我不想使用vs.net创建的默认路由:
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);
我只想要路线获取www.example.com/页面,它是什么? (注意:我不希望www.example.com/default只是简单的www.example.com映射到HomeController Action = Index)。
答案 0 :(得分:1)
我昨天开始玩MVC(测试版),我在我的网页配置中有这个(对于IIS 6.0,删除IIS 7.0的.aspx)
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute("Default", "{controller}.aspx/{action}/{id}", new { controller = "Home", action = "Index", id = "" });
routes.MapRoute("Empty", "", new { controller = "Home", action = "Index", id = "" });
}