MVC 3, Razor, Sitemaps, Uncategorized

MVC Sitemap Provider tutorial 2 – Breadcrumbs

Once you’ve got your sitemap correctly configured and setup, you will be looking to use some of the features of a Sitemap – for example, breadcrumbs. In this post we will start with an empty MVC3 project, and add the sitemap provider, a few controller actions and corresponding views, and we will have the provider produce some breadcrumbs for us.


Lets start from an Empty MVC3 project. Fire up Visual Studio. Create a new Asp.Net MVC3 Web application. I’m going to call mine SitemapDemo:

Create new MVC3 project

For the sake of this demonstration, I have selected an empty template and have chosen Razor as my view engine.

Now before we go any further, lets go ahead and install the NuGet package.  Select View > Other Windows and then select “Package Manager Console”:

Package Manager Console Location VS2010

This will then dock the Package Manager Console somewhere into your view. In order to add the MVC sitemap provider to the current project, we need to enter the following command into the Package Manager Console, and hit enter:

PM> Install-Package MvcSiteMapProvider

This command will then download the necessary files (dlls, cshtml files) and add them into your MVC project. This could take a few minutes depending on your connection. If this has been successful, your Package Manager Console should give you an output similar to the following:

PM> Install-Package MvcSiteMapProvider
Successfully installed 'MvcSiteMapProvider'.
Successfully added 'MvcSiteMapProvider' to SitemapDemo.


Now lets take a look at what exactly the NuGet package manager has added to our project:

  • SitemapDemo > References > MvcSiteMapProvider – This is the reference to the MvcSiteMapProvider dll
  • SitemapDemo > Mvc.sitemap – This file will be used to describe our MVC3 website in XML nodes
  • SitemapDemo > Views > Shared > DisplayTemplates > MenuHelperModel.cshtml
  • SitemapDemo > Views > Shared > DisplayTemplates > SiteMapHelperModel.cshtml
  • SitemapDemo > Views > Shared > DisplayTemplates > SiteMapNodeModel.cshtml
  • SitemapDemo > Views > Shared > DisplayTemplates > SiteMapNodeModelList.cshtml
  • SitemapDemo > Views > Shared > DisplayTemplates > SiteMapPathHelperModel.cshtml
  • SitemapDemo > Views > Shared > DisplayTemplates > SiteMapTitleHelperModel.cshtml

As we’re using Razor as our view engine, we can go ahead and delete the asax files that have been added to the SitemapDemo > Views > Shared > DisplayTemplates folder. Here’s how your solution should now look:

Sitemapdemo Solution Explorer

Now that’s the install over. Let’s add a half decent set of controller actions and views to the site before we go on to playing with the SiteMapProvider. The point of this is to capture the kind of structure that you would find in a typical website.


The MVC Sitemap provider will fail silently in some fashion if we try to force it to work with controller actions that either don’t exist or that point to non existent views. This is why we are doing this stage first.

All sites have a homepage, so lets add this first. Right click on your Controllers folder, and add a controller called “HomeController”. Lets leave the scaffolding options blank:

HomeController-Add Blank

Once your controller is created and open, right click inside the Index action and select “Add View…”

Home Index Add View

In the Add View dialogue that pops up, just go a head hit add. Nothing will need changing.  Now lets change the text inside the created page’s h2 tag on the page – something like “Index – this is the home page” will do.

And now lets add another controller in the same way that we added the HomeController. Let’s call it NewsController. Update the newly created news controller to contain an additional action result called “Sports”:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace SitemapDemo.Controllers
    public class NewsController : Controller
        // GET: /News/

        public ActionResult Index()
            return View();

        // GET: /News/Sports/
        public ActionResult Sports()
            return View();


Now, lets add a view for each of our newly created NewsController actions. Lets do this in the same way that we added the view for the home page – by right clicking within the body of each controller action. Again, we can simply leave all of the defaults in the “Add View” dialogue and just hit “Add” for both views.

Now edit the h2 tag on the News Index cshtml file to read “News Index”. Lets also edit the h2 tag on the News Sports cshtml file to read “Sports News”.

Let’s now add one more Controller for illustration – AboutController. Once created, you can leave the controller unchanged, and can add a view for the Index controller action. This time, lets change the h2 to tags to read “About Page”.

As we have now added 4 pages to our website, it’s now worth just testing them out before we start integrating the Site Map Provider. Hit the debug button – below are screen shots and their corresponding URLs:


SitemapDemo Index


SitemapDemo News Index


SitemapDemo News Sports


SitemapDemo About Index

Ok, so we’ve now got a small site with a little bit of a structure. Lets represent that structure in an easy diagram:

SitemapDemo Sitemap Diagram

Visualising our layout like this will really help us describe our site’s structure in our Mvc.sitemap file correctly. Our Index page is our wrapper for the entire site as it is the page that sits in the root, and is the first port of call into the site.

Now lets get into configuring our Sitemap. Lets start by editing our Mvc.sitemap file, which is in the root of our project. This file contains all of the xml nodes needed to represent your controller and action combinations.

MVC Sitemap xml file vs

Edit your Mvc.Sitemap file so that it is the same as the listing below:

<?xml version="1.0" encoding="utf-8" ?>
<mvcSiteMap xmlns="" enableLocalization="true">
  <mvcSiteMapNode title="Home" controller="Home" action="Index">
    <mvcSiteMapNode title="News" controller="News" action="Index">
      <mvcSiteMapNode title="Sports News" controller="News" action="Sports"/>
    <mvcSiteMapNode title="About" controller="About" action="Index"/>

We have now represented our website structure / workflow in the MVC.Sitemap file. A classic “gotcha” here is forgetting that your entire site is wrapped in a node that represents your homepage. Your sitemap file must contain this node – after all, your website’s homepage is the page that the client sees as the root of everything. So even though the Index action is actually at yourwebsite/Index, the client will typically see it just as yourwebsite/. The rest of the structure should make sense when compared to the website navigation diagram, earlier in this post.

Adding Navigation

Now that we’ve got some controllers and actions setup, and our site structure described properly in our Mvc.Sitemap file, lets add some navigation to all pages.

Open up your _Layout.cshtml partial, located in the Views/Shared folder. Update the listing so that the code between the body tags looks like this:

    @Html.MvcSiteMap().Menu(false, true, true)

We are now calling the MvcSiteMap library and telling it to output the website’s navigation on every page. The parameters specified mean that:

  • We don’t want it to start from the current node (changing this to true will break it!)
  • We want the starting node to appear in child level
  • We want to show the starting node. Setting this to false will hide the parental “Home” node
And now if we run our application, we should see the navigation laid out on every page, complete with links:
Index with navigation

News with navigation

Editing the navigation appearance

So now we’ve managed to output a simple navigation onto all pages of our website. If you want to change any styling, or how the navigation is displayed, simply alter the code in Views/Shared/DisplayTemplates/MenuHelperModel.cshtml. Lets make a simple change and add an inline style to change our bullet points from circles to squares:

    @foreach (var node in Model.Nodes) {
        <li style="list-style-type:square;">@Html.DisplayFor(m => node)
            @if (node.Children.Any()) {
                @Html.DisplayFor(m => node.Children)

You can now hit refresh in your browser without needing to re-compile. Your News index page should now look like this:

News Index Square Bullets


We can add breadcrumbs in a similarly easy fashion. Let’s open up our _Layout.cshtml partial and edit the listing:

    @Html.MvcSiteMap().Menu(false, true, true)
    <p>Start of Breadcrumbs:</p>

Now all pages on our site will have a handy set of breadcrumb links:

News Breadcrumbs MvcSitemap

Sportsnews breadcrumbs MVCSitemap

Similarly, if we want to customise the presentation of our breadcrumbs, we need to change the Views/Shared/DisplayTemplates/SiteMapPathHelperModel.cshtml file.

Dynamic URLs / Parametered URLs

Every real site will need to employ a dynamic / Parametered URL at some point. Incorporating a dynamic URL into the MVC Sitemap is straightforward when you know how. Lets start by adding a new action to the NewsController:

        //GET: News/Article/x
        public ActionResult Article(int id)
   = id;
            return View();

Now lets add a view – right click anywhere within the new action and select “Add View…”. Again, just hit Add – we don’t need to change any of the options. Now update the newly created Article.cshtml file with the following:

    ViewBag.Title = "Article";

<h2>Viewing Article</h2>

Now lets browse to localhost:xxxx/News/Article/1234:

News Article 1234 mvcsitemap

Note that this new page does not appear anywhere in our sitemap, and that the breadcrumbs are totally empty.

In order to add the page into our navigation, we must first decide where it needs to go. I’d like this page to sit underneath the News section. So lets edit our Mvc.Sitemap file and add a Key attribute to the “News” node. This is simply to give it a unique identifier:

<mvcSiteMapNode title="News" controller="News" action="Index" key="News">

Now we need to decorate our controller action with some attributes that tell it where to insert the action in the site’s structure. Update your Article action in your News controller:

        //GET: News/Article/x
        [MvcSiteMapNode(Title = "Article", ParentKey = "News")]
        public ActionResult Article(int id)
   = id;
            return View();

Now lets compile and browse to localhost:xxxx/News/Article/1234:

Article Dynamic MVCSitemap

And we now have Breadcrumbs and navigation for our new page, despite it having a dynamic URL!

Download the Solution

You can download the complete solution here

Recommended Reading:

Pro ASP.NET MVC 3 Framework

73 thoughts on “MVC Sitemap Provider tutorial 2 – Breadcrumbs

  1. Thanks for the tutorial.
    I’ve just started using Mvc Sitemap provider and I have some questions:

    1. When using dynamic url, like you do for your article, how can you display the title of the Article in the breadcrumb ? ie : not “Home > News > Article” but “Home > News > “My article title” (some thing like dynamic titles)

    2. Lets say that in your news controller you would have something like a SubArticles actions that takes 2 urls as parameters SubArticle(string articleUrl, string subArticleUrl). How can I achieve something like “Home > Article > “My article url” > “My sub article title”

    Any help you be appreciated 🙂

    1. I know you can do it by hacking the SiteMapPathHelperModel.cshtml, but it’s not pretty
      Something like
      @if (node.Title == “Article”)
      This code is untested, but we have a similar block in a huge project.

      A better way would be if you could set the title of the node dynamically in the controller. I’ll take a look around and see if this is possible

      And your second question would involve a simialr approach. Something like this in the SIteMapPathHelperModel.cshtml file:

      @if (node.Title == “Article”)
      @Request.QueryString[“articleTitle”] > @Request.QueryString[“articleSubTitle”]

      1. Thanks for t and it works fine
        the reply. inthe end I did something else: I created a custom attribute and OnActionExecuting I took the url and created my breacrum data which I then added to the view bag.

  2. Hi ,
    I used site map provider it was working fine for the calls that allowed the page to be posted back and call an action method of an controller. But when any action is called using as Ajax call of Jquery and particular view is rendered the site maps doesnt updates accordingly though i have made the entry of that action in the XMl file. Please update me on this.

    1. Before I can answer this question, I need to understand how you are loading the content.

      Are you loading an entire page? As in the Ajax is calling a controller action that returns a View?

      If so, what are you doing with the HTML from the view? Is it being rendered onto a section of the page?

      Is a redirect happening?

      If the HTML is being rendered onto the current page, then there is no way that the breadcrumbs will update themselves, unless the breadcrumbs are in the HTML of the newly generated view. Remember that as soon as the HTML is with the client, it cannot be changed unless some AJAX call is made to specifically update a particular element.

      1. Hi Ed I am having View and inside that i am having JQuery Tab on each tab click i am loading the Partial view from the controller
        But while doing this i need to update the breadcrumbs also but MVCSitemapprovider is not doing that.please help me

  3. I’d love to see an example of how to modify the DisplayTemplates to indicate the current page on the menu.

    For example, if you have a menu with two nodes, Home and About, and you’re currently on the About page, indicate this in the menu by underlining the About title.

  4. Hi, Have you used roles with the mvcsitemap provider. I have a 2 level menu in my MVC Site.
    It works well…but the moment I set securitytrimming to “true”, each page takes a long time to render.

    1. Are you running in debug? I understand that the current version of the MVC sitemap provider kicks out masses of errors when running in debug (view the output when starting a debug session). You won’t notice the impact if you’ve got lots of ram – but it would definitely be worth trying it in release mode to see if its any quicker.

  5. How can i preserve the route data for various nodes.

    Let say if i go to URL http://localhost:55555/Home/Person/12 the breadcrumb looks like this on the Person page

    Home > Person

    But as soon as I navigate further into the page, say “Contact”, the breadcrumb looks like this:

    Home > Person > Contact

    But if I try to navigate back to Person page by clicking Person node, none of the url parameters are maintained (e.g. instead of going to http://localhost:55555/Home/Person/12, it goes to http://localhost:55555/Home/Person).

    My sitemap looks something like

    I have also tried preservedRouteParameters but it doesn’t work

    Plz tell me how can i preserve the route data for various nodes in the breadcrumb.


    1. Hi Shafaat,

      If you’re using the preservedRouteParameters attribute, I’d recomend trying the Person page with a passed in parameter – http://localhost:55555/Home/Person?personId=12 instead of http://localhost:55555/Home/Person/12. It could be a bug with this property as it sounds like you are using it correctly.

      If that doesn’t work I’d recommend opening a topic up on the codeplex page for the project – I’ll take a look at it too and see if I can get it working

    1. Thanks Jules

      hmmmm not too sure at the moment. You could have an xml field in the database and have the entire file there, but I’m not sure how you would specify that to be the sitemap file.

      Its a very interesting point though. In a load balanced setup where you have plenty of web servers, it would be nice if you could have just one sitemap file, rather than one on each web server. I’ll take a look into it

  6. Really good example shame it has taken me 2 days to find it (incredibly frustrating as all I want is to stick a few menus on screen :)), im upgrading an old asp app and previously used sitemap but that was years ago, your tutorial is clear specific and exactloy what I was looking for, im more midle tier backend and cant remeber how to do the js or css to have the menus drop down dont supose yo could provide an example 🙂

  7. Very helpful, thank you. Please don’t forget to update with answers for Mihai question about dynamic url and NickS question about showing current page on the menu.

  8. Hi Edward,
    I would like to know if there is a way to set the node title dynamically from the controller. What i need to do is to set the node title with infomration about the parameters that i receive in the controller, rather than using a static node title.

    Any hint will be highly appreciated.

  9. Hello Ed, I am trying to display a different look and feel if the menu item is currently active. I tried to use node.IsInCurrentPath as a flag, but the first node is always returning true. Below is my code on menuhelperModel.cshtml

    @model MvcSiteMapProvider.Web.Html.Models.MenuHelperModel
    @using System.Web.Mvc.Html
    @using MvcSiteMapProvider.Web.Html.Models

    @foreach (var node in Model.Nodes)
    if (node.IsInCurrentPath)
    @Html.DisplayFor(m => node)
    @Html.DisplayFor(m => node)

    Is there a different flag I can use?

  10. Also my controller has the same action either as HttpGet and HttpPost, and i would like to add a breadcrumb for both of them. I have tried to do something like:

    [MvcSiteMapNode(Title = “MyControllerActionGet”, ParentKey = “Home”, Key = “MyControllerActionGet”)]
    public ActionResult MyControllerAction(string viewResultType)


    [MvcSiteMapNode(Title = “MyControllerActionPost”, ParentKey = “MyControllerActionGet”, Key = “MyControllerActionPost”)]
    public ActionResult MyControllerActionPost(string viewResultType, LiquidacionConsulta model)

    But this is not always working properly. Is there a way to accomplish this?
    Thanks in advance,

  11. Hi,

    I’m using ASP.NET MVC 2.0 and MVCSitemap2.0

    My BreadCrumb is displaying like in a page

    DashBoard>>HotelPolicy>>ChildPolicy View”

    Here HotelPricing has a method “Create” and accepts parameter HotelCode , the problem here is i unable to pass hotelcode for Hotelpricing Create method.when i click on HotelPolicy Link that should Navigate to http;//localhost:2287/Policy/HotelPolicy/Create/HTL9834.But when i click on HotelPolicy is redirecting to http;//localhost:2287/Policy/HotelPolicy/Create/. Here I should pass the parameters to Create method of HotelPolicy

    MY complete APP structure is:



    Note: I did only Above thing in my application and i didnot touch controller

  12. Hi Ed – great blog!!

    Ive just implemented the site map provider. I am trying to get the security trimming to work. I have my action method attributed with [Authorize] but the menu node is still showing on the home page before the user log on. Is there something I am missing? Thanks

    1. Hi Greg,

      I’m not too sure about the security trimming, but you could always modify the menu display templates to check for an authorised user before rendering any nodes.

      On any sites I’ve used the sitemap provider we’ve literally not rendered the menu at all on non authenticated pages. So the sites have been more like private enterprise applications.

      I’d be keen to know if you got anywhere with the security trimming.

      If you are totally stuck, it might be worth messaging the guy that wrote the plugin over on github

      Good luck

  13. Hi,

    It’s a wonder why anyone hasn’t asked yet, but isn’t the tree sitemap supposed to be collapsible? No matter what I edit, I can’t only set a maximum node depth to appear wherein ALL the nodes appear. All I get is a tree sitemap that’s fully expanded. What if I’m at Home > Company Information and I want Company Information AND ONLY Company Information to have its nodes expanded?


    – Products
    – Company Information
    – Company Profile
    – Corporate Responsibility
    – Mission and Vision
    – Contact Us
    – Careers

    I don’t want all my level 1 nodes all expanding FFS.

    1. Kyle, that’s down to the presentation.

      Just change your cshtml files to spit out html that works with some css to collapse nodes accordingly.

      This is exactly what we do on several of our sites that use this.

      Remember the Sitemap provider basically gives you nods, and turns those nodes into html. You can customise that html under certain conditions.


      @if(node.Description == "home")
      <li>Home Node</li>
      <li class="collapsed"> Collapsed Node</li>

      And then your CSS obviously has something in it to deal with li.collapsed.

  14. Hello, Edward.

    Do you know how to choose various display templates for nodes? I want to show various node styles in various menus. But Html.MvcSiteMap().Menu(), Html.MvcSiteMap().SiteMapPath() and so forth functions of Html.MvcSiteMap() can receive templates for their own structure only, not for nodes. And all of these functions use single SiteMapNodeModel.cshtml template. How to choose another node template? Is there really only one way – to rewrite the single SiteMapNodeModel.cshtml template?

    1. Hi Hugo,

      When you call @Html.MvcSiteMap().Menu(false, true, true) in your _layout.cshtml page or similar, I believe that there is an overload for this call that will let you specify the template file name.

  15. Awesome. Here is some jquery script I dropped on my partial view to append parameters to each breadcrumb node.

    //Append the ageny as a query string aparameter to all the breadcrumb links. The MVCSiteMapProvider does not include these.
    var currentAgency = $.trim(window.sessionStorage.getItem(“currentAgency”));
    var breadCrumb = $(“.divBreadCrumb”);
    $(breadCrumb).children(‘a’).each(function () {
    $(this).attr(‘href’, $(this).attr(‘href’).trim() + “?yz=” + obfuscateAgencyNumber(currentAgency));

  16. I have the same question as HARI which does not look like it was ever answered. I need to include route values or querystring parameters on the urls in the breadcrumbs. Updating the URL property or adding to the route values in the SiteMapPathHelperModel has absolutely no effect (same as changing the title etc), so basically updates to the properties of the node in this file have no effect, why is that?

  17. I’m getting sick of MvcSiteMapProvider. It seems that everytime I get the latest version, the stupid thing breaks and I have to spend hours trying to figure out why, tweaking my code to make sure it is just right.

      1. There are already plenty of comments expressing similar sentiments. I admit that I wrote that comment in a moment of frustration, but I stand by it nonetheless. I’m using SiteMapProvider for my menus until JQueryUI finally releases theirs to production, then I’ll be switching over.

        1. It’s understandable. We’ve just got it working and left it. We don’t have the budget to spend time fixing previously working areas of the application. We only update something if we feel there is a benefit that we will get from the newer version

  18. Thanks a lot for the tutorials. They are very clear.
    One point. When you write ” ..can go ahead and delete the asax files” I think you mean ascx.

  19. Edward, awesome tut, thank you for it! Quick question, it’s only displaying three levels for me though: Home > Child 1 > Child 2. For example:

    If I’m on the “Blah2” page inside of “Demo1”, it only shows Home > Community > Demo1, where I’d like it to then say > Blah2. Does that make sense?

    1. It didn’t display my code. Lemme try again:

      mvcSiteMapNode title=”Home” action=”Index”
      mvcSiteMapNode title=”Community” action=”Index”
      mvcSiteMapNode title=”Demo1″ action=”Demo1″
      mvcSiteMapNode title=”Blah2″ action=”Blah2″/>

  20. I could make the breadcrumb appear for the Actions in my controller by adding [MvcSiteMapNode(Title=”Search”, ParentKey = “Benefits”)], [MvcSiteMapNode(Title=”Manage”, ParentKey = “Benefits”)] etc.,. But this will add sub menu nodes under Menu though it was not required. How can I Make the bredcrub appear for all actions in my controller without adding a node into the Main menu?

  21. Hi,
    I am using mvc.sitemap file in my mvc project for bread crumbs,this was working fine unless i added authorization in

    project, i have implemented LogonAuthorize class from AuthorizeAttribute class and overrided its OnAuthorization

    method and registered that into GlobalFilterCollection but due to that bread crumbs are not displayed on any pages not sure why?,rest of things are working fine with authorization except bread crumbs.
    Can you please help me out?

  22. I have been looking around but I didn’t find an answer for my problem.

    I would like a menu like this :
    2.Admnistration (Not clickable)

    When I click the Personnel-item I would like to show the following :
    •Create New
    (So no longer displayig the “Holiday” and adding the “Create New”)

    When I click the Home-item, I go back to the index-page showing the first menu.
    Clicking the Holiday-item would show a menu like this:
    •Create New

  23. I am looking for a way to make end-user specified menus/site paths. In fact, there is an application (in PHP, damnit) that does exactly what I am trying to do here (administration site v3, Pages > Administration) – make a drag and drop tree menu entry system for my site that controls both the site map path and main menu.

    I have used ASP.NET sitemaps files in the past and it turned out to be a horribly bad idea for a site with end-user created pages because I literally had every page defined in 3 different places, but then, I never looked into making a site map provider as you have.

    I know you touched on this in another question, but assuming I am not afraid to get my hands dirty myself, what specific extensibility point should I exploit to make a database-driven xml file work with your MvcSiteMapProvider?

  24. I have a Home controller and a Business controller. The business controller has a few action methods on it: Search, Create, Update, Delete. From the Search view I can have a link to the Create view.

    On my home page i have a link that takes me to the Search and Create actions on the Business controller.

    I want the bread crumb to look like the following when Create is accessed from the home page:
    Home > Create

    …and i want it to look like the following when Create is accessed from the Search page:
    Home > Business > Create.

    For the same controller/action method combo, can we achieve the effect i want with MvcSiteMapProvider?

    Many thanks!

  25. Many thanks for the awesome step by step instruction. One thing I like to ask is, how do I get rid of the “>” symbol between each page in the breadcrumbs? Inside of the MenuHelperModel.cshtml UL and both LI tag, I already specified style=”list-style-type:none;” but for some reason, it still show the “>” symbol. Any help is much appreciated.

  26. Ed,

    I first came here seeking your advice, and now I have made a major contribution to the MvcSiteMapProvider by refactoring its design into what is now v4. Honestly, I probably wouldn’t have bothered with it at all if it weren’t for your tutorial.

    I added links to this blog post today from the GitHub site, but setting up v4 is different than what is described here and it would be great if you could do a post or 2 on the new version.


      1. Cool. I have ended up making quite a few tutorials of my own. Now it might be my turn to teach you.

        Not that there isn’t plenty of room for more tutorials – there are still a lot of things about this provider that I only scratched the surface on or didn’t even mention (security, for one). Its amazing how much documentation it takes to cover a measly 5,600 lines of code.

        Anyway, I always appreciate feedback on the project whether positive or negative – it all helps improve the software and/or documentation. I would appreciate yours as well.

        One thing I have been working on is whenever I come across someone with an invalid configuration, I am adding an exception message to be thrown in that case that specifies the solution (rather than throwing an unintelligible message, or simply not working and giving no feedback as to why). This seems like a never ending battle because of seemingly endless ways this thing can be configured. If you find something like this, please send it my way.

    1. Hello !

      First, great work on mvcsitemapprovider, this is quite a good project. There’s still one problem for me, which is, i think, really important :

      Is there an easy way to keep route values?

      I have some results pages, that takes a model, a page number, a page size etc.. in input. I need the BreadCrumb to build a link with the parameters in the URL. The preservedRouteParameters doesn’t work for me.

      Thank you!

      1. @Julien

        There are 2 ways that are practical to make MvcSiteMapProvider work

        1) Add every potential route value as a new node
        2) Use preservedRouteParameters to force multiple requests to match a single node

        For a page number and page size, it generally makes more sense to use preservedRouteParameters in combination with SiteMapTitleAttribute to match a single node. Do keep in mind this will make the Menu and SiteMap HTML helpers function incorrectly – you can usually fix this by using visibility providers to make the multi-match nodes invisible on the Menu and/or SiteMap.

        I have written a blog post that goes into some depth on this topic:

  27. what are configurations to add in two web.config files .iam not installing packages direclty to solutions but i added references of that dlls.. it is not working is showing error as sitemappath is not initialized

  28. Hi, I am just a newbie on mvc technology. I tried following this tutorial for a week but the breadcrumbs is not showing up. only menu is showing. Any ideas about this one?

    Thank you,

    1. what code are you putting to show breadcrumbs and in your view what is being emitted from that code. I think it would be best to create a question on stackoverflow with screenshot and code to debug what you have done.

  29. Hello, I am just new in using mvc technology and I have tried this tutorial, however it seems it is not working properly because the breadcrumb is not showing. but the menu is displaying correctly. Any ideas how to correct this one?

    Thanks 🙂

  30. This is a great tutorial. I have used SiteMapProvider in my MVC application. It is working well until my MVC application is loading a report in iFrame with other site URL (say WebForm project). There I am getting “The type or namespace name ‘MvcSiteMapProvider.Web.Html.Models’ could not be found”. I solved this by copying all the dependent DLLs to other project. But i would like to know is there any other better idea or solution for this kind of scenarios. Thank you.

    1. Hi Nick,

      I’m afraid it’s long gone. This post is quite old now, so I’d recommend you take a more modern approach.

      What are you tying to do? Have site navigation generate automatically from a sitemap file?

Leave a Reply to John Emerson Buenviaje Cancel reply

Your email address will not be published. Required fields are marked *