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:
- GridView Control.
- XMLDataSource Control
We have to set the following properties of the XMLDataSource Control:
- DataFile: to the file where the XML feeds reside, for example: http://www.c-sharpcorner.com/rss/AuthorArticles.aspx?authorId=a85b23
- set XPath="rss/channel/item"
Here is the code for XMLDataSource:
- <asp:XmlDataSource ID="xmlBanking" runat="server" DataFile="http://www.c-sharpcorner.com/rss/AuthorArticles.aspx?authorId=a85b23"
- XPath="rss/channel/item"></asp:XmlDataSource>
I will use the c-sharpcorner.com XML file that you can get from the following:
- Here is the Gridview Control code:
-
- <asp:GridView ID="bank" runat="server" DataSourceID="xmlBanking" BorderWidth="0" CssClass="Grid" PagerStyle-CssClass="pgr"
- AutoGenerateColumns="False" CellPadding="2" ForeColor="Black" AllowPaging="True"
- PageSize="5">
- <Columns>
- <asp:TemplateField HeaderText="Rss Feed in Asp.Net">
- <ItemTemplate >
- <asp:Label ID="Label1" runat="server" Text='<%# XPath("pubDate") %>' ForeColor="gray"
- Font-Bold="True" Font-Names="Verdana" Font-Size="XX-Small">
- </asp:Label>
-
- <asp:Label ID="Label4" runat="server" Text='<%# XPath("author") %>' ForeColor="gray"
- Font-Bold="True" Font-Names="Verdana" Font-Size="XX-Small">
- </asp:Label>
- <br />
- <asp:HyperLink ID="HyperLink1" runat="server" Text='<%# XPath("title") %>' NavigateUrl='<%# XPath("link") %>'
- Target="_blank" Font-Names="Verdana" Font-Size="X-Small">
- </asp:HyperLink>
- <br />
- <asp:Label ID="Label2" runat="server" Text='<%# XPath("description") %>' ForeColor="gray"
- Font-Bold="True" Font-Names="Verdana" Font-Size="XX-Small">
- </asp:Label>
- </ItemTemplate>
- <AlternatingItemTemplate>
- <asp:Label ID="Label3" runat="server" Text='<%# XPath("pubDate") %>' ForeColor="gray"
- Font-Bold="True" Font-Names="Verdana" Font-Size="XX-Small">
- </asp:Label>
- <asp:Label ID="Label4" runat="server" Text='<%# XPath("author") %>' ForeColor="gray"
- Font-Bold="True" Font-Names="Verdana" Font-Size="XX-Small">
- </asp:Label>
- <br />
- <asp:HyperLink ID="HyperLink2" runat="server" Text='<%# XPath("title") %>' NavigateUrl='<%# XPath("link") %>'
- Target="_blank" Font-Names="Verdana" Font-Size="X-Small">
- </asp:HyperLink>
- <br />
- <asp:Label ID="Label2" runat="server" Text='<%# XPath("description") %>' ForeColor="gray"
- Font-Bold="True" Font-Names="Verdana" Font-Size="XX-Small">
- </asp:Label>
- </AlternatingItemTemplate>
- </asp:TemplateField>
- </Columns>
- </asp:GridView>
-
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).