FeedBurner and HttpWebRequest Failure

by aboo bolaky 26. September 2008 08:34

 

The other day, I subscribed this blog to FeedBurner . This was all meant to be the way forward Tongue out. What i was trying to do was to use a Web Request to someone's feed url (in my example, http://feeds.feedburner.com/aboobolaky) to gather a few blog entries from the feed (a bit like the blog roll on the left hand side!).

It turns out that the web request fails with a status of "ProtocolError" , with an Exception of "The remote server returned an error: (404) Not Found." . However, if you use an RSS Reader or even point your web browser to the link, it works just fine!! Foot in mouth

Question here..How do we isolate the problem?

  • Is this intentional?
  • Is a proxy server responsible for this?
  • Or, maybe it has something to do with the User Agent?

 

I'll be thinking about this and post an update sooner or later.

In the meantime, I'd better revert my feed url to how it was before

using System;
using System.Configuration;
using System.Data;
using System.Web;
using System.Text;
using System.Net;
using System.IO;
using System.Xml;

public partial class _Default : System.Web.UI.Page
{ 
public class RequestState 
{ 

// This class stores the State of the request. 
const int BUFFER_SIZE = 1024; 
public StringBuilder requestData; 
public byte[] BufferRead; 
public HttpWebRequest Request; 
public HttpWebResponse response; 
public Stream streamResponse; 

	public RequestState() 
	{ 
		BufferRead = new byte[BUFFER_SIZE]; 
		requestData = new StringBuilder(); 
		Request = null; 
		streamResponse = null; 
	} 
} 
protected void Page_Load(object sender, EventArgs e) 
{ 
	HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create("http://feeds.feedburner.com/aboobolaky"); 
	RequestState myRequestState = new RequestState(); 
	myRequestState.Request = httpRequest; 
	httpRequest.BeginGetResponse(ProcessResponse, myRequestState); 
} 
private static void ProcessResponse(IAsyncResult async) 
{ 
	RequestState state = (RequestState)async.AsyncState;
	try 
		{ 
			using (HttpWebResponse response = (HttpWebResponse)state.Request.EndGetResponse(async)) 
				{ 
					XmlDocument doc = new XmlDocument(); 
					doc.Load(response.GetResponseStream()); 
					XmlNodeList nodes = doc.SelectNodes("rss/channel/item"); 
					foreach (XmlNode node in nodes) 
					{ 
						string title = node.SelectSingleNode("title").InnerText; 
						/*likewise,list the relevant nodes under /rss/channel/item..*/ 
					} 
				} 
		} 
	catch (System.Net.WebException ex) 
		{
			throw ex; 
		}
} 

} 

Tags: ,

.Net | Asp.Net

Comments

11/7/2011 3:06:28 PM #

visite Marrakech

We’re a gaggle of offers further breach a unfamiliar intrigue in our district. Your trap place offered us accompanying precious info to portraits on. You’ve accomplished a menacing employment further our gross locality ability be thankful to you.

visite Marrakech France |

11/13/2011 2:24:22 PM #

visite Marrakech

Precise stimulating junctures you possess renowned , admire it for posting . “Success is a migration, hardly a aim. The doing is frequent further noteworthy than the consequence.” by Arthur Ashe.

visite Marrakech France |

11/16/2011 6:08:28 AM #

salon immobilier maroc

I got what you design, esteem it for putting up.Woh I am thankful to locate this website around google. “The ocular of a man life is a microscope, which manufactures the creation seem bigger than it actually is.” by Kahlil Gibran.

salon immobilier maroc France |

Tag cloud

Flash Player 9 required.

About Me

I wish I could write something here..
//TODO: ElaborateMe