I’m trying to programmatically download an RSS feed using a simple C# WebForms application.
The URI for the RSS feed contains an authorisation token which is specific to my login details.
If I request the RSS feed using a WebBrowser control then the feed is wrapped in HTML and is un-parseable.
If I request the RSS feed using
var rssXml = new XmlDocument();
rssXml.Load(feedUri);
Then it returns a 401 – Unauthorized response.
However, I can open a browser, clear all cookies for the host site (in fact, a rarely-used browser which I’ve never used for visiting the host site) and use the same RSS URI and the expected RSS feed is received. This suggests that the authorisation token in the URI is accepted.
So how come I can’t successfully request the RSS feed by using this code?
var rssXml = new XmlDocument();
rssXml.Load(feedUri);
For anyone looking at this question for an answer, please see @L.B.’s comment above.