How to Make RSS Feed With ASP.Net

Let's start with some basic information about RSS Feeds.
 
RSS
 
Rich Site Summary (RSS) is a format for delivering regularly changing web content. Includes full or summarized text and metadata, like publishing date and author's name. Many news-related sites, weblogs and other online publishers syndicate their content as an RSS Feed to whoever wants it. It is also known as Really Simple Syndication.
 
Why RSS? Benefits and Reasons for using RSS
 
RSS solves a problem for people who regularly use the web. It allows you to easily stay informed by retrieving the latest content from the sites you are interested in. You save time by not needing to visit each site individually. We can easily integrate XML feeds into our website. We don't want to have detailed knowledge of XML.
 
Go to Visual Studio then select File -> New Website  then select Empty ASP.Net Website or whatever you want.

On Default.aspx Page add the following two controls:
  1. GridView Control.
  2. XMLDataSource Control 
We have to set the following properties of the XMLDataSource Control:
  1. DataFile: to the file where the XML feeds reside, for example: http://www.c-sharpcorner.com/rss/AuthorArticles.aspx?authorId=a85b23

  2. set XPath="rss/channel/item"
Here is the code for XMLDataSource:
  1. <asp:XmlDataSource ID="xmlBanking" runat="server" DataFile="http://www.c-sharpcorner.com/rss/AuthorArticles.aspx?authorId=a85b23"  
  2.                XPath="rss/channel/item"></asp:XmlDataSource>  
I will use the c-sharpcorner.com XML file that you can get from the following:
 
 
 
  1. Here is the Gridview Control code:  
  2.   
  3. <asp:GridView ID="bank" runat="server" DataSourceID="xmlBanking" BorderWidth="0" CssClass="Grid" PagerStyle-CssClass="pgr"  
  4.                 AutoGenerateColumns="False" CellPadding="2" ForeColor="Black" AllowPaging="True"  
  5.                 PageSize="5">  
  6.                 <Columns>  
  7.                     <asp:TemplateField HeaderText="Rss Feed in Asp.Net">  
  8.                         <ItemTemplate >  
  9.                             <asp:Label ID="Label1" runat="server" Text='<%# XPath("pubDate") %>' ForeColor="gray"  
  10.                                 Font-Bold="True" Font-Names="Verdana" Font-Size="XX-Small">  
  11.                             </asp:Label>  
  12.   
  13.                              <asp:Label ID="Label4" runat="server" Text='<%# XPath("author") %>' ForeColor="gray"  
  14.                                 Font-Bold="True" Font-Names="Verdana" Font-Size="XX-Small">  
  15.                             </asp:Label>  
  16.                             <br />  
  17.                             <asp:HyperLink ID="HyperLink1" runat="server" Text='<%# XPath("title") %>' NavigateUrl='<%# XPath("link") %>'  
  18.                                 Target="_blank" Font-Names="Verdana" Font-Size="X-Small">  
  19.                             </asp:HyperLink>  
  20.                             <br />  
  21.                             <asp:Label ID="Label2" runat="server" Text='<%# XPath("description") %>' ForeColor="gray"  
  22.                                 Font-Bold="True" Font-Names="Verdana" Font-Size="XX-Small">  
  23.                             </asp:Label>  
  24.                         </ItemTemplate>  
  25.                         <AlternatingItemTemplate>  
  26.                             <asp:Label ID="Label3" runat="server" Text='<%# XPath("pubDate") %>' ForeColor="gray"  
  27.                                 Font-Bold="True" Font-Names="Verdana" Font-Size="XX-Small">  
  28.                             </asp:Label>  
  29.                              <asp:Label ID="Label4" runat="server" Text='<%# XPath("author") %>' ForeColor="gray"  
  30.                                 Font-Bold="True" Font-Names="Verdana" Font-Size="XX-Small">  
  31.                             </asp:Label>  
  32.                             <br />  
  33.                             <asp:HyperLink ID="HyperLink2" runat="server" Text='<%# XPath("title") %>' NavigateUrl='<%# XPath("link") %>'  
  34.                                 Target="_blank" Font-Names="Verdana" Font-Size="X-Small">  
  35.                             </asp:HyperLink>  
  36.                             <br />  
  37.                             <asp:Label ID="Label2" runat="server" Text='<%# XPath("description") %>' ForeColor="gray"  
  38.                                 Font-Bold="True" Font-Names="Verdana" Font-Size="XX-Small">  
  39.                             </asp:Label>  
  40.                         </AlternatingItemTemplate>  
  41.                     </asp:TemplateField>  
  42.                 </Columns>  
  43.             </asp:GridView>  
  44.    
 

RSS compared to Atom

Both RSS and Atom are widely supported and are compatible with all the major consumer feed readers. RSS gained wider use because of early feed reader support. Technically, Atom has several advantages; it has a less restrictive licensing, IANA-registered MIME type, XML namespace, URI support and relaxed NG support.
 
Summary 
 
Several major sites, such as Facebook and Twitter, previously offered RSS feeds but have reduced or removed support. Additionally, widely-used readers such as Shiira, FeedDemon and Google Reader have been discontinued having cited declining popularity in RSS. However, RSS still remains a widely used standard. RSS support was removed in OS X Mountain Lion's versions of Mail and Safari, although the features were partially restored in Safari 8. As of January 2015, Mozilla Firefox and Internet Explorer include RSS support by default, with the notable exception of Google Chrome. Additionally, reader services such as Feedly provide synchronization between desktop RSS readers and mobile devices. (Source Wikipedia).

Up Next
    Ebook Download
    View all
    Learn
    View all