title: MvcSiteMapProvider Sitemap Generation with MVC Attrivbute Routing
body: <p>I am working on a MVC5 project where I need to create a sitemap.</p>
  
  <p>I have created my routes using Route Attribute on the controller actions.</p>
  
  <p>I am using a Dynamic node provider as specified in the documentation for MvcSiteMapProvider and it works fine for one of my controllers, however for another one it is displaying the query string paramaters for each mapped route so for example</p>
  
  <p>I am getting</p>
  
  <p>www.url.com?SelectedCulture=en-gb</p>
  
  <p>when I am expecting</p>
  
  <p>www.url.com/en-gb</p>
  
  <p>My routes all work fine and if I use my application it is working fine aswell...  It just doesnt create a sitemap which i am expecting</p>
  
  <p>The Dynamic provider that I created is populating the required attribute that matches the route.</p>
  
  <p>Anyone have any ideas?</p>
  
  <p><strong>This is my Mvc.sitemap xml</strong></p>
  
  <pre><code>&lt;mvcSiteMapNode title="ATitle" controller="Parent" action="Index" key="Home"&gt;
  &lt;mvcSiteMapNode title="ASubTitle" controller="Parent" action="Index" key="CulturePages"&gt;
  &lt;/mvcSiteMapNode&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>This is my dynamicNodeProvider</strong></p>
  
  <pre><code>public class SitePagesDynamicProvider : DynamicNodeProviderBase
  {
      public override IEnumerable&lt;DynamicNode&gt; GetDynamicNodeCollection(ISiteMapNode node)
      {
          using (var ef = new EntityFrameworkRepository())
          {
              // Create a node for each sites 
              foreach (var obj in ef.GetIDs();
              {
                  DynamicNode dynamicNode;
  
                      dynamicNode = new DynamicNode();
                      dynamicNode.Title = obj.title;
                      dynamicNode.ParentKey = "CulturePages";
                      dynamicNode.RouteValues.Add("SelectedCulture", obj.culture);
                      yield return dynamicNode;
              }
          }
      }
  }
  </code></pre>
  
  <p><strong>And this is my Controller Action:</strong></p>
  
  <pre><code>[MvcSiteMapNodeAttribute(Title = "Sites", Key = "Sites", ParentKey = "HomePages", DynamicNodeProvider = "TestProject.Models.SitePagesDynamicProvider, TestProject")]
      [Route("{SelectedCulture:regex(^([a-z]|[A-Z]){2}-([a-z]|[A-Z]){2}?$)?}/")]
      public ActionResult Index(string SelectedCulture)
      {
         return View();
      }
  </code></pre>
  
  <p>Thanks!</p>