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?