Building an MCMS Site-Map Provider
To build a custom SiteMapProvider
, we will create a class that inherits from the base SiteMapProvider
class and implement four methods inherited from the base:
The
FindSiteMapNode()
method returns a site map node based on a given URL or GUID.The
GetChildNodes()
method returns a collection of nodes of a specified parent node.The
GetParentNode()
method returns the parent node of a specified child.The
GetRootNodeCore()
method returns the first node in the hierarchy.
As the navigation controls for the TropicalGreen site provide links to channel items, each site map node maps to a corresponding channel item. Nevertheless, you can easily modify the methods to display template gallery items or resource gallery items instead. Now, let's proceed to build the MCMSSiteMapProvider
class.
The MCMSSiteMapProvider Class
To keep things simple, we can take advantage of another new capability within ASP.NET: the App_Code
folder. The App_Code
folder also allows us to add...