I'm glad you found a solution. By the way, this may be a security risk:
wajans wrote:
System.IO.FileInfo targetfile = new System.IO.FileInfo(anchor.HRef);
If somebody hacks an HTTP request, they can potentially send back an arbitrary file name (which would give them access to pretty much any file on your website, such as the web.config).