0

I have implemented a dynamic node provider by specifying the node provider name in a mvcSiteMapNode in the SiteMap file and it works fine. However, I only want to add the dynamic nodes once the user has authenticated. The reason being is that I want to access the HttpContext.User.Identity so that I can filter the nodes by user.Identity.

So, I have removed the mvcSiteMapNode in the SiteMap file and instead I am calling the GetDynamicNodeCollection method in an Action method (once the user has authenticated)and the nodes are getting filtered by the user. This is also working as expected.

My question: Once I have got the nodes, how do I add them to the SiteMapNodeCollection so that they are displayed in the view that is returned from the ActionResult?

tereško
  • 58,060
  • 25
  • 98
  • 150
Greg
  • 2,654
  • 3
  • 36
  • 59

1 Answers1

1

This would probably be a job for a SiteMapNodeVisibility provider, and not for the DynamicNodeProvider.

The reason is the caching of the nodes.

Xharze
  • 2,703
  • 2
  • 17
  • 30
  • Besides whether or not the correct provider is being used, the main issue is that the providers are triggered when the sitemap is first accessed. This means there is no way of controlling when the nodes are generated and rendered. Documentation is virtually non existent as are responses on the GITHUB forum. I'm at the point of dropping the MvcSiteMapProvider because its application is very limited. – Greg Apr 23 '12 at 13:12