MVC3、C#4、Razor、MvcSiteMapProvider V4 を使用しています。
mvc.sitemap ファイルの MvcSiteMapNodes を、global.asa のルートに明示的にバインドしようとしています。しかし、うまくいかないようです。私が何かを省略したことは間違いありません。
global.asa の私のルート:
routes.MapRoute("Report", "Report/{ClientId}", new { controller = "Report", action = "Index", ClientId = UrlParameter.Optional });
routes.MapRoute("Report_Section", "Report/{ClientId}/Section/{ReportId}", new { controller = "Section", action = "FilterByReport", ReportId = UrlParameter.Optional });
私の mvc.sitemap の一部:
<mvcSiteMapNode title="Reports" controller="Report" action="Index" preservedRouteParameters="ClientId" route="Report">
<mvcSiteMapNode title="Sections" route="Report_Section">
したがって、私の2つのURLは次のとおりです。
報告ルート:
Report/10
Reports_Sections ルート:
Report/10/Section/100
2 番目のルートで認識されていないため、パンくずリストが該当ページに表示されません。mvc.sitemap で "route" 属性を指定するだけで、mvcSiteMapProvider が 2 つをバインドすることを期待していました。
考え。どこで間違ったのですか?
どうもありがとう
編集:
「mvc.sitemap」に「controller」と「action」を指定する必要があり、「route」だけでは動作しないようです。
<mvcSiteMapNode title="Sections" controller="Section" action="FilterByReport" route="Report_Section" preservedRouteParameters="ClientId,ReportId">