Access Secure Feed with SyndicationFeed

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);



Comments

No comments yet.

Add Yours

  • Author Avatar

    YOU


Comment Arrow




About Author

Robert

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning hands down.