maartenba / MvcSiteMapProvider

An ASP.NET MVC SiteMapProvider implementation for the ASP.NET MVC framework.
Microsoft Public License
539 stars 218 forks source link

Multiple nodes with the same key 'node_key' were found. SiteMap requires that sitemap nodes have unique keys #497

Closed yrios-cdd closed 2 years ago

yrios-cdd commented 2 years ago

The menu is built using an implementation of IDynamicNodeProvider. It is not possible for the list returned by the GetDynamicNodeCollection method to include repeated nodes. The error only occurs with a user doing web scraping, when users use the application normally, the error does not occur.

The app uses Ninject as a DI container. I thought it might be related to the MvcSiteMapProvider cache and tried disabling it in: https://github.com/maartenba/MvcSiteMapProvider/blob/f2427af693273eb57ce5b412804d7d0eed29a451/src/MvcSiteMapProvider/CodeAsConfiguration/Ninject/DI/Ninject/Modules/MvcSiteMapProviderModule.cs#L26

I've also tried changing the scope of the instances to InRequestScope() in: https://github.com/maartenba/MvcSiteMapProvider/blob/f2427af693273eb57ce5b412804d7d0eed29a451/src/MvcSiteMapProvider/CodeAsConfiguration/Ninject/DI/Ninject/Modules/MvcSiteMapProviderModule.cs#L72

But the error continues