Registering the provider

Shad Storhaug edited this page Feb 9, 2014 · 1 revision

Want to contribute? See our Contributing to MvcSiteMapProvider guide.



Version 4.x Documentation


Unofficial Documentation and Resources

Other places around the web have some documentation that is helpful for getting started and finding answers that are not found here.

Tutorials and Demos

Version 4.x
Version 3.x

Forums and Q & A Sites

Other Blog Posts

Clone this wiki locally

After downloading the MvcSiteMapProvider, you will have to add a reference to the assembly in your project. Also, you will have to register the provider in your Web.config file. Add the following code somewhere in the <system.web> section:

<siteMap defaultProvider="MvcSiteMapProvider" enabled="true"> 
  <providers> 
    <clear /> 
    <add name="MvcSiteMapProvider" 
         type="MvcSiteMapProvider.DefaultSiteMapProvider, MvcSiteMapProvider" 
         siteMapFile="" 
         securityTrimmingEnabled="false" 
         cacheDuration="5"
         enableLocalization="false" 
         scanAssembliesForSiteMapNodes="false" 
         excludeAssembliesForScan="" 
         includeAssembliesForScan="" 
         attributesToIgnore="" 
         nodeKeyGenerator="MvcSiteMapProvider.DefaultNodeKeyGenerator, MvcSiteMapProvider" 
         controllerTypeResolver="MvcSiteMapProvider.DefaultControllerTypeResolver, MvcSiteMapProvider" 
         actionMethodParameterResolver="MvcSiteMapProvider.DefaultActionMethodParameterResolver, MvcSiteMapProvider" 
         aclModule="MvcSiteMapProvider.DefaultAclModule, MvcSiteMapProvider" 
         siteMapNodeUrlResolver="MvcSiteMapProvider.DefaultSiteMapNodeUrlResolver, MvcSiteMapProvider"
         siteMapNodeVisibilityProvider="MvcSiteMapProvider.DefaultSiteMapNodeVisibilityProvider, MvcSiteMapProvider"
         siteMapProviderEventHandler="MvcSiteMapProvider.DefaultSiteMapProviderEventHandler, MvcSiteMapProvider"
         /> 
  </providers> 
</siteMap>


The following configuration directives can be specified:

Directive Required? Default Description
siteMapFile No (empty) The sitemap XML file to use.
securityTrimmingEnabled No false Use security trimming? When enabled, nodes that the user can not access will not be displayed in any sitemap control.
cacheDuration No 5 Number of minutes the sitemap is cached on the server before refreshing nodes.
enableLocalization No false Enables localization of sitemap nodes.
scanAssembliesForSiteMapNodes No false Scan assemblies for sitemap nodes defined in code?
excludeAssembliesForScan No (empty) Comma-separated list of assemblies that should be skipped when scanAssembliesForSiteMapNodes is enabled. Note that all assemblies in the ~/bin folder except those referenced in the excludeAssembliesForScan attribute are scanned for sitemap nodes.
includeAssembliesForScan No (empty) Comma-separated list of assemblies that should be included when scanAssembliesForSiteMapNodes is enabled. Note that only assemblies referenced in the includeAssembliesForScan attribute are scanned for sitemap nodes.
attributesToIgnore No (empty) Comma-separated list of attributes defined on a sitemap node that should be ignored by the MvcSiteMapProvider.
nodeKeyGenerator No MvcSiteMapProvider.↵
DefaultNodeKeyGenerator,
MvcSiteMapProvider
Class that will be used to generate sitemap node keys.
controllerTypeResolver No MvcSiteMapProvider.↵
DefaultControllerTypeResolver,
MvcSiteMapProvider
Class that will be used to resolve the controller for a specific sitemap node.
actionMethodParameterResolver No MvcSiteMapProvider.↵
DefaultActionMethodParameterResolver,
MvcSiteMapProvider
Class that will be used to determine the list of parameters on a sitemap node.
aclModule No MvcSiteMapProvider.↵
DefaultAclModule,
MvcSiteMapProvider
Class that will be used to verify security and access rules for sitemap nodes.
siteMapNodeUrlResolver No MvcSiteMapProvider.↵
DefaultSiteMapNodeUrlResolver,
MvcSiteMapProvider
Class that will be used to generate URLs for sitemap nodes.
siteMapNodeVisibilityProvider No MvcSiteMapProvider.↵
DefaultSiteMapNodeVisibilityProvider, MvcSiteMapProvider
Class that will be used to determine visibility for a sitemap node.
siteMapProviderEventHandler No MvcSiteMapProvider.↵
DefaultSiteMapProviderEventHandler
Class that can handle specific events, such as when adding a SiteMapNode.