This project has moved. For the latest updates, please go here.

Consuming password protected feeds?

Topics: Developer Forum
Dec 29, 2007 at 7:17 AM
Edited Dec 29, 2007 at 8:25 AM
Is this possible with the RSSToolkit?

I have seen plenty of examples for creating feeds but not many for consuming and certainly none that showed how to support authenticated feeds?

EDIT I managed to this via the following. Do still let me know if there is a better way.
// Need to call via System.Net.WebRequest to support authentication
WebRequest request =
WebRequest.Create(Properties.Settings.Default.FeedUrl);
if (userName.Text.Length > 0 && password.Text.Length > 0)
{
request.Credentials = new NetworkCredential(userName.Text, password.Text);
}
WebResponse response = request.GetResponse();
Stream responseStream = response.GetResponseStream();
XmlTextReader reader = new XmlTextReader(responseStream);

RssDocument document = RssDocument.Load(reader);

Jan 12, 2010 at 8:48 AM

I indeed having problems with the same issue.

 

I want to consume feeds from our local intranet MOSS - but I have to provide my windows credentials to do so.

Still havent found a solution to this

May 17, 2010 at 7:04 PM

Hi guys,

I had a similar problem, trying to consume from intranet SharePoint site. Couldn't turn on anonymous access, so constant 401s. 

Hacked it together using RssDocument. Here's a sample, luckily I can use a service account, though I'm sure this can be changed for Windows Auth if need be:

WebClient wc = new WebClient();
wc.Credentials = new NetworkCredential("username", "password");
string strXML = wc.DownloadString("url");
RssToolkit.Rss.RssDocument rss = RssToolkit.Rss.RssDocument.Load(strXML);
gvXML.DataSource = rss.SelectItems();
gvXML.DataBind();