A while back I was trying to consume some XML from a third party site and I found myself getting stuck on an error. The site would not give me a valid response and would throw up a 403 error. After digging around I found that I left off the user-agent info in the request header. So the moral to this story is: Don't forget your user-agent!
Code Sample after the break.
1: try
2: { 3: //Get the Document from the url.
4: WebClient client = new WebClient();
5: client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)"); 6: doc.LoadXml(client.DownloadString(SourceXML));
7:
8:
9: ...
10: ...
11: ...
12:
13: }