Quantcast
Channel: Scalability Blog » ASP.NET
Viewing all articles
Browse latest Browse all 10

Access Secure Feed with SyndicationFeed

$
0
0

In this example we are going to access a secure RSS feed using SyndicationFeed. This is done by setting the NetworkCredentials in the XmlUrlResolver, and then setting the XmlUrlResolver in the XmlReaderSettings and finally passing the XmlReaderSettings into the XmlReader.Create() method.


XmlUrlResolver urlResolver = new XmlUrlResolver();
urlResolver.Credentials = new NetworkCredential("username","password");

XmlReaderSettings readerSettings = new XmlReaderSettings();   
readerSettings.XmlResolver = urlResolver;

XmlReader xmlReader = XmlReader.Create(@"http://www.example.com/feed.rss", readerSettings);

SyndicationFeed feed = SyndicationFeed.Load(xmlReader);


Viewing all articles
Browse latest Browse all 10

Trending Articles