C# 未选择基于属性的站点地图节点

C# 未选择基于属性的站点地图节点,c#,asp.net-mvc,mvcsitemapprovider,C#,Asp.net Mvc,Mvcsitemapprovider,考虑以下设置: public class SampleController : BaseController { [MvcSiteMapNode(Title = "Super Title", Key = "Super", ParentKey = "topNav")] public ActionResult Index() { return View(); } [MvcSiteMapNode(Title = "Sub Title", Par

考虑以下设置:

public class SampleController : BaseController
{
    [MvcSiteMapNode(Title = "Super Title", Key = "Super", ParentKey = "topNav")]
    public ActionResult Index()
    {
        return View();
    }

    [MvcSiteMapNode(Title = "Sub Title", ParentKey = "Super")]
    public ActionResult SubAction(Guid id)
    {
        return View();
    }
}
导航到子操作时,Html.MvcSiteMap().SiteMap.CurrentNode始终为空。 但有时它只适用于单个Guid(我想是第一个请求的Guid)

为什么?


除此之外,它还适用于我的项目中的所有其他操作。

我只需添加preservedureParameters=“true”


这涵盖了“如何”,至于“为什么”,请看这篇文章:谢谢。非常有帮助!
[MvcSiteMapNode(Title = "Sub Title", ParentKey = "Super", PreservedRouteParameters = "id")]
public ActionResult SubAction(Guid id)
{
    return View();
}