SiteMapPath breadcrump disappears when navigating to a child page

463 Views Asked by At

My problem example could not be simpler. 1-Open VS2013, start a new ASP.NET 4.5 WebForms project. 2-add a SiteMapPath component to the masterpage. 3-add a std web.sitemap to the project.

Now, create any hierarchy of parent, child pages and see how the breadcrumb disappears from these pages. At most it displays on the root node (default.aspx page) and that is it.

This is frustrating because I have older projects (compiling in VS2013) using SiteMapPath and the breadcrumb works well. Maybe this new Bootstrap or V2013 ASP.NET template is doing something to cause the failure.

Please use this exact example above if assisting with an answer and since I have done this successfully before please don’t discuss “relative paths” and “valid URLs” I see on other posts – I know this, the basics are covered and the sitemap is valid because an ASP Menu displays the pages 100% in their hierarchy.

Thanks Mike

1

There are 1 best solutions below

0
On

I seem to be the only one still using breadcrumbs with the newer .NET/VS projects.

The answer is to remove the .aspx extension from the sitemap file which is added normally. Ie, the newer routing model in the new VS ASP.NET projects/NuGet packages strips this from the URL and SiteMapPath will not be able to resolve the URL with the sitemap URL. You could fight it and change the routing definition I understand or accept that it's best practice to not have your extension showing and deal with the sitemap.

I chose to go with extensionless URLs and if you have a large sitemap file like me, just search and replace .aspx with nothing.