Home » Articles


Sponsored links

CodeDigest Navigation

Technology News
No News Feeds available at this time.

Community News
No News Feeds available at this time.
RSS Reader in ASP.Net 2.0

By Satheesh babu
Posted On Jun 07,2008
Article Rating:
Be first to rate
this article.
No of Comments: 0
Category: ASP.Net
Print this article.

RSS Reader in ASP.Net 2.0


RSS feed is an xml formatted document that gives us the capability to read frequently updated contents on our websites without visiting our site. It is one of the web 2.0 features which allow users to read the relevant information’s available on the internet. All we need to do is to get the RSS feed URL from different sites of our interest and subscribe it on our RSS reader. This article will help us to construct our own RSS reader in ASP.Net.

Before moving into actual implementation of RSS reader we will understand a sample Rss document.


For example, CodeDigest Rss feed will look like,

<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0">


  <title> Latest Articles</title>


  <description>Latest articles hosted on</description>


  <title>Useful Datagrid Tips</title>

  <description>There are some frequent queries that are being asked in most of the forums and UG’s regarding datagrid. I have compiled a list of useful tips from my previous posts and posted it here.</description>


  <pubDate>4/29/2008 9:47:12 AM</pubDate>





As we can see the above XML the whole contents is packed inside <rss> tag. The actual information about the posts is kept inside <item> tag which in turn is packed inside a <channel> tag. Read the history( and specification of RSS here( )


Binding RSS feed to DataList

This can be done using DataSet object ReadXml() method XmlTextReader Object.

XmlTextReader reader = null;



            reader = new XmlTextReader("");

            DataSet ds = new DataSet();


            dlRSS.DataSource = ds.Tables["item"];



        catch (Exception ex)


            lblMessage.Text = ex.Message;






From the sample RSS XML given above, we can find the actual posts/articles in the table with the name “item” because they are packed inside the <item> tag.


    <asp:DataList ID="dlRSS" runat="server" Width="100%">


                    <div class="RSSTitle"><asp:HyperLink ID="TitleLink" runat="server" Text='<%# Eval("title") %>' NavigateUrl='<%# Eval("link") %>'/></div>

                    <div class="RSSSubtitle"><asp:Label ID="SubtitleLabel" runat="server" Text='<%# Eval("description") %>' /></div>

                    <div class="RSSInfo">

                        posted on <asp:Label ID="DateRSSedLabel" runat="server" Text='<%# Eval("pubDate", "{0:d} @ {0:t}") %>' />





The output will be similar to below,


Since the above code connects to an external site to download the contents the best practice is to cache it instead of downloading it again and again. To do this we can put the datalist inside a user control and include an output cache directive like below.


<%@ OutputCache Duration="3600" VaryByParam="None" %>


Read the article posted by Suprotim on consuming RSS feed using XmlDataSource controls here.

Consuming RSS Feed



Thus we can use RSS feeds to get the information without visiting the actual website. Also, we can use the RSS feed to get the latest news, technical articles etc from a different website and post it on our websites. Visit our homepage ( where we have used the RSS feed of and got all the latest articles posted on the site. I will discuss the implementation of construction of RSS feeds for our sites in my next article.

Happy Coding!!


Similar Articles
You can contribute to CodeDiget.Com:
Donate to
Article Feedback