1
我想用我的C#文件中定義的路由屬性爲創建XML站點地圖(MVCSiteMap)文件是這樣的:如何獲得MVCSiteMap包括我所有的自定義路由
[RoutePrefix("{culture}/Registration/Person")]
public partial class PersonController : BaseController
{
[HttpPost]
[Route("Step1")]
public ActionResult StartStep1() {}
}
,並創建一個XML文件是這樣的:
<mvcSiteMapNode title="Registration" controller="Person" action="Index" >
<mvcSiteMapNode title="Registration Person" route="Step1" controller="Person" action="Index" />
</mvcSiteMapNode>
但是路由屬性被忽略,結果是:
Additional information: A route named 'Step1' could not be found in the route collection.
我的web.config文件配置是這樣的:
<add key="MvcSiteMapProvider_IncludeRootNodeFromSiteMapFile" value="true" />
<add key="MvcSiteMapProvider_AttributesToIgnore" value="" />
<add key="MvcSiteMapProvider_CacheDuration" value="5" />
<add key="MvcSiteMapProvider_UseExternalDIContainer" value="false" />
<add key="MvcSiteMapProvider_ScanAssembliesForSiteMapNodes" value="true" />