How can I generate hierarchical Sitemap in .NET 8 Web Application?

Siddhant Singh 5 Reputation points
2024-07-08T21:04:38.9533333+00:00

In .NET Framework we have an

ASP.NET Core Training
ASP.NET Core Training
ASP.NET Core: A set of technologies in the .NET Framework for building web applications and XML web services.Training: Instruction to develop new skills.
24 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Michael Taylor 54,316 Reputation points
    2024-07-08T21:20:50.27+00:00

    There is no such thing in ASP.NET Core. sitemaps don't really play well into how MVC works. Furthermore, unless your site is dynamically generating routes from the DB as well like a content management site, then sitemaps stored in the DB don't really make any sense at all. Just because there is some URL in a database doesn't mean it actually exists. To get the actual information you would really need to just look at the routing table that the runtime uses. But you'd need to annotate it so you could tell the difference between routes you want in the map and those you don't.

    Here is a link to one person's attempt at getting sitemaps working in ASP.NET Core. You can check out their solution and see if it might fit into what you are looking for.

    0 comments No comments

  2. Neuvi Jiang 1,300 Reputation points Microsoft Vendor
    2024-07-09T03:01:01.3966667+00:00

    Hi Siddhant Singh,

    Thank you for posting in the Q&A Forums.

    In .NET 8 (or more specifically, in ASP.NET Core, since the .NET Framework and ASP.NET Core are two different but related technology stacks), there is no built-in asp:SitemapPath control, since ASP.NET Core is intended to be more flexible and modular. However, you can emulate this functionality with a custom implementation.

    Best regards

    NeuviJ

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.