Posted on Thu 9 April 2009
I got this exception after 2 minutes or so of waiting when consuming an RSS feed from Digg.com. It was strange seeing as the feed loaded instantly when I viewed it in a browser.
I discovered I could solve the problem by adding the following line of code (where the object req is a HttpWebRequest object):
req.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14";
Where req is the HttpWebRequest object. This just pretends to be a browser so that Digg doesn't timeout the request.
Permalink
|
Comments (0)
Tags: digg, feed, httpwebrequest, rss, timeout, webexception.
Categories: ASP.NET | C#.
Comments
< go back to the main blog page