Click here to Skip to main content
11,575,925 members (57,177 online)
Click here to Skip to main content

RSS Feed using ASP.NET 2.0

, 9 Jan 2006 151.2K 3.3K 64
Rate this:
Please Sign up or sign in to vote.
This RSS Feed example will explain how to consume an RSS Feed in eight easy steps..!

Introduction

This article will explain how to consume an RSS Feed from another website using ASP.NET 2.0. I have tried to keep this article very simple so that even beginners can easily understand this. This article will explain to you how to use RSS Feeds in eight easy steps using ASP.NET 2.0!

Background

Before you start reading/implementing the steps using this article, hope you are aware of RSS Feeds. RSS means Really Simple Syndication. Nowadays, every dynamic web site, has this feature named RSS. Using RSS Feeds, you can be in sync with the changes/additions made to your favourite shopping website or your favourite techie blog website.

Using the code

OK. Let's start. Please follow the following seven easy steps and your RSS Feed webpage will be ready to consume RSS from a given website:

  1. Start -> Programs -> Microsoft Visual Web Developer 2005 Express Edition.

  2. Now, go to File -> New Website to create a new website. Select Location=File System, Language=Visual Basic, and give the default web site path (by default, it will create a new website at C:\Documents and Settings\default\My Documents\Visual Studio 2005\WebSites).

  3. Then, drag the XMLData source component from Toolbox -> Data -> XMLDataSource to the blank WebForm.

  4. Click on XMLDataSource Tasks - > Configure Data Source link to configure the data source. Now, this is the actual thing in the whole project.

  5. Then, you will see the ConfigureDataSource window which has the following paths to be specified to consume the XML data:
    • Data File = Data file will be your RSS Feed path. In my case, it is http://spaces.msn.com/members/mauliksoni/feed.rss.
    • Transformation File = we are not currently using any XML transformation file, so leave it blank.
    • XPath Expression = again, this is very much important. An XPath variable will be used later on in our code to get the specific RSS Feed link. Give it as rss/channel/item now.
  6. The next step is to drag the DataList control from Toolbox -> Data -> DataList to the WebForm.

  7. Then, click on the Choose Data Source dropdown for the DataList and select XMLDataSource1.

  8. And then the final step. Switch to the HTML Source View of the WebForm and paste the following code:
    <ASP:DataList...> 
     <ItemTemplate> 
     </ItemTemplate> 
    </ASP:DataList>

    And then, press F5 in your project to Run the project. Please refer the example source file for any further details.

Info

Q-1. How should I obtain the RSS feed path?

Ans. You will require a path to the RSS Feed from any given website to actually consume the RSS Feed of that website. In my example, I have used http://spaces.msn.com/members/mauliksoni/feed.rss, but you can use any RSS path. To get the RSS feed path from any website, try to locate the word RSS or look for its image in the website. Then click on RSS or XML, your browser will be redirected to the XML formatted page. Now copy the link form IE.

History

N/A

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Maulik Soni
Other Cincinnati Children's Biomedical Informatics
United States United States
http://www.linkedin.com/in/mauliks

You may also be interested in...

Comments and Discussions

 
QuestionRSS Feed Consumer Pin
nihantanu31-Aug-12 1:42
membernihantanu31-Aug-12 1:42 
Questionthis is my error so plz help me Pin
himeshpandiyaa9-Nov-11 19:43
memberhimeshpandiyaa9-Nov-11 19:43 
[XmlException: Reference to undeclared entity 'raquo'. Line 20, position 103.]
   System.Xml.XmlTextReaderImpl.Throw(Exception e) +122
   System.Xml.XmlTextReaderImpl.Throw(String res, String arg, Int32 lineNo, Int32 linePos) +80
   System.Xml.XmlTextReaderImpl.HandleGeneralEntityReference(String name, Boolean isInAttributeValue, Boolean pushFakeEntityIfNullResolver, Int32 entityStartLinePos) +462
   System.Xml.XmlTextReaderImpl.ResolveEntity() +199
   System.Xml.XmlLoader.LoadAttributeNode() +476
   System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace) +332
   System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc) +96
   System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) +485
   System.Xml.XmlDocument.Load(XmlReader reader) +175
   System.Web.UI.WebControls.XmlDataSource.PopulateXmlDocument(XmlDocument document, CacheDependency& dataCacheDependency, CacheDependency& transformCacheDependency) +441
   System.Web.UI.WebControls.XmlDataSource.GetXmlDocument() +255
   System.Web.UI.WebControls.XmlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +63
   System.Web.UI.WebControls.BaseDataList.GetData() +72
   System.Web.UI.WebControls.DataList.CreateControlHierarchy(Boolean useDataSource) +483
   System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e) +92
   System.Web.UI.WebControls.BaseDataList.DataBind() +103
   System.Web.UI.WebControls.BaseDataList.EnsureDataBound() +94
   System.Web.UI.WebControls.BaseDataList.CreateChildControls() +110
   System.Web.UI.Control.EnsureChildControls() +140
   System.Web.UI.Control.PreRenderRecursiveInternal() +124
   System.Web.UI.Control.PreRenderRecursiveInternal() +292
   System.Web.UI.Control.PreRenderRecursiveInternal() +292
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4774

GeneralMy vote of 5 Pin
MontyEsoft29-Sep-10 3:37
memberMontyEsoft29-Sep-10 3:37 
GeneralMy vote of 1 Pin
jorgepitgh20-Jul-10 5:24
memberjorgepitgh20-Jul-10 5:24 
GeneralRelated To ur Post Pin
RohitKabadi21-Jan-10 20:29
memberRohitKabadi21-Jan-10 20:29 
GeneralMy vote of 1 Pin
Muthuganesh28-Sep-09 19:09
memberMuthuganesh28-Sep-09 19:09 
GeneralMy vote of 1 Pin
Muthuganesh28-Sep-09 19:09
memberMuthuganesh28-Sep-09 19:09 
GeneralMy vote of 1 Pin
Muthuganesh28-Sep-09 19:08
memberMuthuganesh28-Sep-09 19:08 
QuestionLinks not opening in new window.. Pin
MSRAHUL11-May-09 2:36
memberMSRAHUL11-May-09 2:36 
AnswerRe: Links not opening in new window.. Pin
dotnetrangarajesh24-Nov-11 18:21
memberdotnetrangarajesh24-Nov-11 18:21 
GeneralLinks not opening in new window Pin
MSRAHUL11-May-09 2:34
memberMSRAHUL11-May-09 2:34 
QuestionHow to Combine Rss Feed data comes from more than one rss feed? Pin
Yadav A Kumar11-Nov-08 7:10
memberYadav A Kumar11-Nov-08 7:10 
GeneralRss file Pin
umeshdaiya15-Jul-08 22:16
memberumeshdaiya15-Jul-08 22:16 
GeneralRSS Feed detail Pin
aspmike5-Mar-08 10:53
memberaspmike5-Mar-08 10:53 
GeneralUnable to locate RSS feed... Pin
krishnaveer13-Nov-07 20:00
memberkrishnaveer13-Nov-07 20:00 
GeneralDoesnt work Pin
DarynRoberts19-Aug-07 23:27
memberDarynRoberts19-Aug-07 23:27 
GeneralShow only last x posts Pin
Falkenberg30-Jan-07 3:39
memberFalkenberg30-Jan-07 3:39 
GeneralMy Forum RSS Feed Pin
RadioButton30-Jun-06 12:59
memberRadioButton30-Jun-06 12:59 
GeneralRSS Feed doesn't work, once deployed in the IIS Pin
Dilumt3-May-06 23:06
memberDilumt3-May-06 23:06 
GeneralRe: RSS Feed doesn't work, once deployed in the IIS Pin
mssoni4-May-06 3:23
membermssoni4-May-06 3:23 
GeneralRe: RSS Feed doesn't work, once deployed in the IIS Pin
Dilumt4-May-06 17:13
memberDilumt4-May-06 17:13 
GeneralRe: RSS Feed doesn't work, once deployed in the IIS Pin
Kanedogg0826-Dec-07 19:01
memberKanedogg0826-Dec-07 19:01 
GeneralRe: RSS Feed doesn't work, once deployed in the IIS Pin
pvnpras4-May-11 2:58
memberpvnpras4-May-11 2:58 
JokeRSS Toolkit Pin
Mohamed A. Meligy1-May-06 18:56
memberMohamed A. Meligy1-May-06 18:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150603.1 | Last Updated 9 Jan 2006
Article Copyright 2006 by Maulik Soni
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid