。我通過在SiteMapTitle屬性中傳遞viewData值來創建站點地圖標題。當我第一次訪問鏈接時會根據需要創建breadCrumb,但是當我嘗試重新訪問來自我的網站的任何其他鏈接時,它將顯示Viewdata對標題的首次訪問值。代碼如下所示MvcSiteMapProvider沒有更新地圖標題
[SiteMapPreserveRouteData]
[SiteMapTitle("atlas")]
public ActionResult Index(string id ,string Atlas)
{
if (!string.IsNullOrEmpty(Atlas))
{
ViewData["atlas"] = Atlas;
}
Taxonomy taxonomy = db.GetTaxonomy(new Guid(ConfigurationManager.AppSettings["TherapyId"]));
var atlasList = taxonomy.GetTerms(id, 2);
return View(atlasList);
}
站點地圖看起來這
<mvcSiteMapNode title="Home" controller="Home" action="Index" changeFrequency="Always" updatePriority="Normal" >
<mvcSiteMapNode title="Therapy" controller="Therapy" action="Index" >
<mvcSiteMapNode title="" controller="Atlas" action="Index" >
<mvcSiteMapNode title="" controller="Specialties" action="Index">
<mvcSiteMapNode title="" controller="Specialties" action="ViewImage" />
</mvcSiteMapNode>
</mvcSiteMapNode>
</mvcSiteMapNode>
任何幫助,將不勝感激