Check below mentioned links for more info.
15 Helpful Web Based Broken Link Checkers
Plugin:
Broken Link Checker
Features of above plugin
Monitors links in your posts, pages, comments, the blogroll, and custom fields (optional).
Detects links that don't work, missing images and redirects.
Notifies you either via the Dashboard or by email.
Makes broken links display differently in posts (optional).
Prevents search engines from following broken links (optional).
You can search and filter links by URL, anchor text and so on.
Links can be edited directly from the plugin's page, without manually updating each post.
Highly configurable.
UPDATE
Why are you going to reinvent the wheel? Just use above plugin by using below mentioned url.
Extending WordPress with C# Plugins
I hope this will help to you.