Localization in SitemapNodeInfo

Topics: Web Client Software Factory, Project Management Forum, UIP Application Block discussion, User Forum
Mar 28, 2009 at 6:52 AM
I am working webapplication project .Problem is Localization in SiteMapNodeInfo
I try 

SiteMapNodeInfo moduleNode = new SiteMapNodeInfo("Home", "~/", "$resources:MyAppGlobalResourceFile,MyKey,MyDefaultValue");


SiteMapNodeInfo moduleNode = new SiteMapNodeInfo("Administration", "~/Administration/Default.aspx", "$resources:Common,Administration,Administration");



but not working  please send any solution.

Apr 1, 2009 at 6:20 PM


You can try using implicit expressions to localize the title of the node like it is explained in this old thread:

·         Localization of SiteMapNodes broken?


As it is said in that thread, you should perform the following steps:

1.       Create a Resource file inside the App_GlobalResources in your WebSite (in this example: ResourceFile.resx).

2.       Add a Resource key inside the resource file for the Node’s title:

    Key: “MyNode.Title”

    Value: “Your Node’s Title”

3.       Add a class inside the App_Code folder of your WebSite that inherits from ModuleSiteMapProvider and override the initialize method with the following code:

    public class MySiteMapProvider : Microsoft.Practices.CompositeWeb.Providers.ModuleSiteMapProvider


        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)


            base.Initialize(name, config);

      this.EnableLocalization = true;

      this.ResourceKey = "ResourceFile"; // name of the Global Resource File



4.       Modify your Web.Config file inside your WebSite to use your new SiteMap Provider:

    <siteMap defaultProvider="MySiteMapProvider" enabled="true">


            <add name="DefaultSiteMapProvider" type="Microsoft.Practices.CompositeWeb.Providers.ModuleSiteMapProvider, Microsoft.Practices.CompositeWeb" securityTrimmingEnabled="true"/>

            <add name="MySiteMapProvider" type="MyModuleSiteMapProvider, APP_CODE" securityTrimmingEnabled="true"/>



5.       Update your RegisterSiteMapInformation methods inside your Module’s controllers to use implicit expressions:

    protected virtual void RegisterSiteMapInformation(ISiteMapBuilderService siteMapBuilderService)


        // add menu items

  SiteMapNodeInfo node = new SiteMapNodeInfo("NodeKey", "~/Default.aspx", "Default Node Title");


    // set the resource key

    node.ImplicitResourceKey = "MyNode";





Performing this steps you should retrieve the Node’s Title without problem. Also, you may want to check the following article that talks about SiteMaps localization:

·         How to: Localize Site-Map Data


Please, let me know if this helps.


Ezequiel Sculli


Apr 2, 2009 at 4:46 AM
I am not understanding this code. plz explain english.
Nov 13, 2009 at 3:56 PM

I completely understand the explanation - that's not the problem! Its a solultion that works, but has one big failing in my mind: this breaks the modularity of the whole application.

From what I'm reading, we will have to define strings in a resource file in the Shell projectthat will cover all the needs of all the modules that will ever be a part of this shell... but the Shell project should not know the intricate details of its modules, its the module's responsibility to know about itself including its resources.

This goes right against the whole point of the WCSF, has anyone found a modular solution to this?

Dec 2, 2009 at 7:10 AM



Is there someone else that can´t seem to get this working? I have followed escullis example and it doesn´t work. Tried it in another project to with the same results. No localization for the sitemap nodes.

Please help.