As per the article How to Make MvcSiteMapProvider Remember a User’s Position
(http://www.shiningtreasures.com/post/2013/09/02/how-to-make-mvcsitemapprovider-remember-a-user-position), this code example does not seem to work when security trimming is enabled:
public ActionResult Edit(int id)
{
var node = SiteMaps.Current.FindSiteMapNodeFromKey("Product_Edit");
if (node != null)
{
node.RouteValues["id"] = id;
var parent = node.ParentNode;
if (parent != null)
{
parent.RouteValues["id"] = id;
}
}
// Implementation omitted
}
Here's what looks like is happening:
- SiteMaps.Current.FindSiteMapNodeFromKey causes AuthorizeAttributeAclModule.FindRoutesForNode method to be executed
- AuthorizeAttributeAclModule.FindRoutesForNode is calling RequestCacheableSiteMapNode.Url and causing the URL to be cached for the request
- The action method will execute and modify the RouteValues but it has no effect because
- RequestCacheableSiteMapNode.get_URL calls GetCachedOrMemberValue with the storeInCache argument set to true
I'm not sure exactly would be the most sensible way to fix this issue. Perhaps if the RouteValues property is modified that the request cache is cleared?
As per the article How to Make MvcSiteMapProvider Remember a User’s Position
(http://www.shiningtreasures.com/post/2013/09/02/how-to-make-mvcsitemapprovider-remember-a-user-position), this code example does not seem to work when security trimming is enabled:
Here's what looks like is happening:
I'm not sure exactly would be the most sensible way to fix this issue. Perhaps if the RouteValues property is modified that the request cache is cleared?