5,660,782 members and growing! (15,358 online)
Email Password   helpLost your password?
Desktop Development » Miscellaneous » General     Intermediate License: The Code Project Open License (CPOL)

Google Site Map Crawler

By Summer_son

Console application that chacks all URLs listed in sitemap.xml file
C# (C# 1.0, C# 2.0, C# 3.0, C#), Windows (Windows, NT4, Win2K, WinXP, Win2003, Vista, TabletPC, Embedded), Win32, CEO

Posted: 13 Dec 2007
Updated: 13 Dec 2007
Views: 3,129
Bookmarked: 7 times
Announcements
Loading...



Search    
Advanced Search
Sitemap
1 vote for this Article.
Popularity: 0.00 Rating: 1.00 out of 5
1 vote, 100.0%
1
0 votes, 0.0%
2
0 votes, 0.0%
3
0 votes, 0.0%
4
0 votes, 0.0%
5
Note: This is an unedited contribution. If this article is inappropriate, needs attention or copies someone else's work without reference then please Report This Article

Introduction

Have you ever thought of trying to validate each URL listed in your sitemap file?

Background

I have a site with dynamically generated page links. Those links are generated based on a page title which can be any combination of letters, numbers and symbols. Of course, the site does remove all forbidden characters from the page title before generating its URL, trims and shortens it a bit... however errors still occur from time to time. For example, a page with a title: ''...IS_BROKEN'' ''' due to my URL conversion specifics will have the following URL: /.IS_BROKEN+ There are thousands of pages so it’s clear that I can not verify each separate page that the site’s database contains.

Based on a list of dynamically generated URLs I generate a sitemap.xml file. Which contains all of the site pages. So each time a map-file is generated I need to ensure that there are no repeating items (this may happen if different pages have same titles) and each separate URL is accessible, i.e. does not produce either bad request, or 404 or anything like that.

So I created a C# program that walks through each URL listed in the sitemap.xml file and tries to access it. It logs all errors occurred into an output file, so it’s easy to track problem pages.

I use XmlDocument class for loading a sitemap.xml; WebRequest and WebResponse classes for determination of whether a URL exists.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Summer_son



Location: Ukraine Ukraine

Other popular Miscellaneous articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Search Search Messages 
 Layout  Per page   
  (Refresh) 
-- There are no messages in this forum --

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 13 Dec 2007
Editor:
Copyright 2007 by Summer_son
Everything else Copyright © CodeProject, 1999-2008
Web11 | Advertise on the Code Project