开发者

Add a sitemap provider at runtime in asp.net (MVC framework)

开发者 https://www.devze.com 2022-12-13 04:10 出处:网络
I\'m building a regionalized site each region has it own sitemap and own content. The regions can be added at runtime.

I'm building a regionalized site each region has it own sitemap and own content. The regions can be added at runtime. Is there any way to add a sitemap provider at runtime?

I need multiple site map providers at once so that I can leverage the m开发者_运维问答vcsitemap without to many changes.


You can create your custom site map provider in order to take information from database or from another file than web.sitemap.

Example of database sitemap: http://msdn.microsoft.com/en-us/magazine/cc163657.aspx


There is an MVC sitemap provider available at: http://mvcsitemap.codeplex.com/

I'm using it for a project right now. It has caching functionality built into the code so your overhead shouldn't be too bad. Even in debug mode running the sitemap for every request takes < 100 ms so I wouldn't worry about performance.

Your performance concerns are a little yagni too. "Could be quite resource consuming". You don't know so your just prematurely optimizing.

0

精彩评论

暂无评论...
验证码 换一张
取 消