我使用的是MVC3,C#,Razor,mvcSiteMapProvider V4。我似乎在MvcSiteMapProvider Breadcrumb蹤跡中獲得一個GUID,不知道爲什麼?
我使用 「Mvc.sitemap」
<mvcSiteMapNode title="Reports" controller="Report" action="Index" preservedRouteParameters="ClientId" route="Report">
<mvcSiteMapNode key="Report_Section" title="Sections" controller="Section" action="FilterByReport" preservedRouteParameters="ClientId,ReportId" route="Report_Section">
<mvcSiteMapNode key="Background" title="Background" controller="Wizard" action="Index" preservedRouteParameters="ClientId,ReportID,SectionID,SectionName" route="Background"/>
的 「Global.asax中」 定製路線是這樣的:
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 });
routes.MapRoute("Background", "Report/{ReportID}/SectionID/{SectionID}/SectionName/{SectionName}", new { controller = "Wizard", action = "Index", ReportID = UrlParameter.Optional, SectionID = UrlParameter.Optional, SectionName = UrlParameter.Optional });
「報告」 和 「Report_Section」 路線做工精細。但是,當我進入「背景」路線時,我在mvcSiteMap BreadCrumb URL中丟失了「Report_Section」和「Report」路線的所有路線結構。相反,我得到一個GUID即:
http://localhost/7ebe9bb9-a663-43fd-9fb1-865866be12b9
我相信這可能是自動生成的XML節點密鑰。然而,它點擊後生成404。
我應該得到的東西,如:
報告
http://localhost/Report/10
第
http://localhost/Report/10/Section/100
任何想法可能是造成這個?
謝謝。
感謝這..真的很有幫助。這個GUID問題讓我撓了撓頭。 – SamJolly