「ASP.NET MVC/ルーティング」の版間の差分

imported>Administrator
ページの作成:「ASP.NET MVCの'''ルーティング’’’とは、リクエストURIを、あらかじめ決められたルールに基づいていくつかのパラメータに...」
 
imported>Administrator
5行目: 5行目:


<source lang="csharp">
<source lang="csharp">
            routes.MapRoute(
routes.MapRoute(
                "Default", // ルート名
    // ルート名
                "{controller}/{action}/{id}", // パラメーター付きの URL
    "Default",  
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // パラメーターの既定値
 
            );
    // パラメーター付きの URL
    "{controller}/{action}/{id}",
 
    // パラメーターの既定値
    new {
        controller = "Home",
        action = "Index",  
        id = UrlParameter.Optional  
    }  
);
</source>
</source>