質問
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にマッピングしたくない)。
解決
昨日MVCをいじり始めたところ(ベータ版)で、これをWeb構成に持っています(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 = "" });
}
所属していません StackOverflow