Click here to Skip to main content
15,905,238 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
HI all,

I am having some problem while consuming rss feed from facebook. It is sending back as a response.This is the behaviour of facebook rss feeds. So i am not able to read it. Can anyone help me in consuming rss feeds in applications.

Any help will be highly appreciated.
Thanks in advance.

I think Facebook news rss requires authentication?

browser.php redirects to PageNotFound error. :sigh:

I think this might be the issue with authentication.
Share this answer
No authentication is right. There was some problem in code itself. Correct code for this is:

HttpWebRequest request = ((HttpWebRequest)(WebRequest.Create(strURL)));
request.Timeout = 10000;
request.UserAgent = "Code Sample";
HttpWebResponse response = (HttpWebResponse)(request.GetResponse());
Encoding enc = Encoding.GetEncoding(1252);
StreamReader responseStream = new StreamReader(response.GetResponseStream(), enc);
string strHTML = responseStream.ReadToEnd();
XmlDocument xmlDoc = new XmlDocument();
DataTable dtRss = new DataTable();
XmlNodeList rssItems = xmlDoc.SelectNodes("rss/channel/item");
for (int i = 0; i < rssItems.Count; i++)

DataRow dr;
dr = dtRss.NewRow();
XmlNode rssDetail;
rssDetail = rssItems.Item(i).SelectSingleNode("title");
if (rssDetail != null)
dr["TITLE"] = rssDetail.InnerText;
rssDetail = rssItems.Item(i).SelectSingleNode("link");
if (rssDetail != null)
dr["LINK"] = rssDetail.InnerText;
rssDetail = rssItems.Item(i).SelectSingleNode("description");
if (rssDetail != null)
dr["DESCRIPTION"] = rssDetail.InnerText;
rssDetail = rssItems.Item(i).SelectSingleNode("pubDate");
if (rssDetail != null)
string strDate = rssDetail.InnerText;
DateTime dtPubDate = Convert.ToDateTime(strDate);
dr["PUBDATE"] = dtPubDate.ToLongDateString() + " " + dtPubDate.ToShortTimeString();

Thanks for your help.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900