これは、物件詳細ページ用に現在生成されている URL です。
http://localhost:61346/Property/Details?strap=0001020005
これは読んでほしい
http://localhost:61346/Property/Details/0001020005
以下は私の登録ルートです。これは MVC3 で簡単にセットアップできますか? この形式の「RegisterRoutes」をセットアップする方法を説明するための追加ポイント
http://localhost:61346/Property/0001020005
<--単にアクション名を非表示にします
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Property", // Route name
"{controller}/{action}/{ParcelId}", // URL with parameters
new { controller = "Property", action = "List", ParcelId = UrlParameter.Optional } // Parameter defaults
);
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
routes.MapRoute(
"Details", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Property", action = "Details" } // Parameter defaults
);
}