Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7622359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:25:52+00:00 2026-05-31T04:25:52+00:00

I use this project to generate the sitemap path. In my application I would

  • 0

I use this project to generate the sitemap path.

In my application I would like the sitemap path to stay as follows:

Path: Home > Projects > {project-name}
Url: /projects/{url-project}

Path: Home > Projects > {project-name} > Photos
Url: /projects/{url-project}/photos

Path: Home > Projects > {project-name} > Addresses
Url: /projects/{url-project}/addresses

Path: Home > Projects > {project-name} > Admin
Url: /projects/{url-project}/admin

Attemps

For this I created an implementation of DynamicNodeProviderBase

public class ProjectDetailsDynamicNodeProvider : DynamicNodeProviderBase
{
    private readonly IProjectRepository _projectRepository;
    public ProjectDetailsDynamicNodeProvider()
    {
        _projectRepository = DependencyResolver.Current.GetService<IProjectRepository>();
    }

    #region Overrides of DynamicNodeProviderBase

    public override IEnumerable<DynamicNode> GetDynamicNodeCollection()
    {
        // Build value 
        var returnValue = new List<DynamicNode>();
        var listDB = (from p in _projectRepository.Query()
                      select new { p.Name, p.Keyword, p.Description });

        // Create a node for each project
        foreach (var project in listDB.ToList())
        {
            var node = new DynamicNode { Title = project.Name, Description = project.Description };
            node.RouteValues.Add("url", project.Keyword);

            returnValue.Add(node);
        }

        // Return 
        return returnValue;
    }

    #endregion
}

Mvc.sitemap

<mvcSiteMapNode title="Projects" controller="Project" action="Index">
  <mvcSiteMapNode title="New project" controller="Project" action="Create" />

  <mvcSiteMapNode title="Project" action="About" controller="Project" dynamicNodeProvider="BindSolution.Infra.ProjectDetailsDynamicNodeProvider, BindSolution">
    <mvcSiteMapNode title="Photos" controller="Project" action="Photos" />
    <mvcSiteMapNode title="Addresses" controller="Project" action="Addresses" />
    <mvcSiteMapNode title="Admin" controller="Project" action="Admin" />
  </mvcSiteMapNode> 
</mvcSiteMapNode>

Result

Path: Home > Projects > {project-name}
Url: /projects/{url-project}

Path: Project > Photos
Url: /projects/{url-project}/photos

Path: Project > Addresses
Url: /projects/{url-project}/addresses

Path: Project > Admin
Url: /projects/{url-project}/admin

Research

Looking on the internet, I found this question on stackoverflow, but not quite understand the resolution or it does not fit into my question.
Anyway, if this is the answer you could give me more details of how to implement the solution?

Thank you all for your help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T04:25:54+00:00Added an answer on May 31, 2026 at 4:25 am

    Our code is /country/{countryname}/
    /country/{countryname}/profiles

    And this is what I came up. So I would substitute country with url-project. The only problem that I am noticing with this method, so I don’t know if it’s the best, is that with our countries (we have 210) we run out of memory. I did this was states (50) and a few others and did not have a problem. I’m having a problem with countries though, also we have 9 different pages listed at the top. When I keep it to 4, I don’t have a problem. Hope this helps.

    public class CountriesDynamicNodeProvider : DynamicNodeProviderBase
    {
        globalEDGEDataContext _db = new globalEDGEDataContext();
        public override IEnumerable<DynamicNode> GetDynamicNodeCollection()
        {
            var returnValue = new List<DynamicNode>();
            foreach (var category in _db.CountriesList().Select(a => a.Title))
            {
                DynamicNode node = new DynamicNode("country_" + Tags.MakeUrlFriendly(category), category);
                node.RouteValues.Add("country", Tags.MakeUrlFriendly(category));
                yield return node;
            }
        }
    }
    
    public class CountriesPagesDynamicNodeProvider : DynamicNodeProviderBase
    {
        globalEDGEDataContext _db = new globalEDGEDataContext();
        public override IEnumerable<DynamicNode> GetDynamicNodeCollection()
        {
            foreach (var category in _db.CountriesList().Select(a=>a.Title))
            {
                DynamicNode node = new DynamicNode();
                node.Title = "Profile";
                node.ParentKey = "country_" + Tags.MakeUrlFriendly(category);
                node.RouteValues.Add("country", Tags.MakeUrlFriendly(category));
                yield return node;
            }
        }
    }
    

    The example works for MVC5 as well. Slightly modified:

      public class DepartmentEmployeeDynamicNodeProvider: DynamicNodeProviderBase
    {
        AlertsContext db = new AlertsContext();
    
        public override IEnumerable<DynamicNode> GetDynamicNodeCollection(ISiteMapNode node)
        {
            // Build value 
            var returnValue = new List<DynamicNode>();
    
            // Create a node for each department 
            foreach (var department in db.Departments)
            {
                var dynNode = new DynamicNode();
                dynNode.Title = department.DepartmentName;
                dynNode.RouteValues.Add("id", department.ID);
    
                returnValue.Add(dynNode);
            }
    
            // Return 
            return returnValue; 
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i use this code to fill dropdownlist ViewData[projectType] = new SelectList (_dataManager.Project.ProjectTypeList(), Id, Name);
I'm using GSON for a project. In particular I use this code to generate
In my project I'd like to use T4 to generate my enums. To test
I want to use this C code in my C++ project : mysql.c :
I am trying to use this jQuery plugin (jsTree) in one of my project.
I'm duty-bound by policy to use CVS in this certain project, so even though
It seems to be possible in this project ... After they use pd =
I'm working on a project in C#, it's about E-learning.This project should use plug-ins
This weekend I was working on a project and I needed to use a
Hi I am doing my project in PHP.In this when the use r doesnt

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.