RssFeed - Now With Authentication Capabilities

Published 25 October 05 12:29 PM | Scott Mitchell

Made a minor upgrade today to RssFeed, my open-source, custom, compiled ASP.NET server control for displaying RSS content in an ASP.NET page. Specifically, version 1.9.3 includes a new property, Credentials, that can be assigned an object that implements ICredentials. Using this new property, RssFeed can now display feeds that are protected using authentication schemes, such as Basic or Digest.

To slurp down an RSS feed that requires authentication, you'd use code like:

CredentialCache myCache = new CredentialCache();
myCache.Add(new Uri(URL_to_RSS_feed), "Basic|Digest", new NetworkCredential(username, password));

RssFeedID.Credentials = myCache;
RssFeedID.DataSource = URL_to_RSS_feed;
RssFeedID.DataBind();

That's all there is to it! The RssEngine class's GetDataSource() method includes an override that takes in an ICredentials object, which is what the class and method RssFeed class uses underneath the covers when specifying the RSS feed source as a URL.

Also added to the code base was a new exception type, FeedException, which is thrown when there is some sort of web-related exception when accessing a RSS feed from a URL. The existing exception FeedTimeoutException, which is thrown when the timeout for accessing the remote feed expires, was refactored to derive from this new base class.

Enjoy!

Filed under:

Comments

No Comments

Leave a Comment

(required) 
(required) 
(optional)
(required) 

Archives

My Books

  • Teach Yourself ASP.NET 4 in 24 Hours
  • Teach Yourself ASP.NET 3.5 in 24 Hours
  • Teach Yourself ASP.NET 2.0 in 24 Hours
  • ASP.NET Data Web Controls Kick Start
  • ASP.NET: Tips, Tutorials, and Code
  • Designing Active Server Pages
  • Teach Yourself Active Server Pages 3.0 in 21 Days

I am a Microsoft MVP for ASP.NET.

I am an ASPInsider.