ASP.NET Web.sitemap to Generate sitemap.xml

TroySteven picture TroySteven · Oct 26, 2012 · Viewed 9.2k times · Source

Basically, I'm trying to find a way to setup a handler so that will run whenever someone goes to http://www.example.com/sitemap.xml web.sitemap xml. When the user or bot hits that url I want to pull my local Web.sitemap file in my solution and generate sitemap.xml syntax. This syntax must conform to https://www.sitemaps.org/protocol.html syntax.

Answer

Darren Wainwright picture Darren Wainwright · Oct 26, 2012

I always prefer doing my own code, rather than use a library, where possible and did this some time ago - can't find the code right now, though this tutorial will get you going. It basically reads the sitemap and then uses the information to create a new google sitemap.

you can also extend it to add in any pages you may have in a database. Skies the limit really :)

It's in both C# and VB

Here is the tutorial | dynamic create google sitemap aspnet