Click here to Skip to main content
13,768,883 members
Click here to Skip to main content
Add your own
alternative version


18 bookmarked
Posted 18 Apr 2008
Licenced CPOL

Keyword Matching RSS Reader Control

, 18 Apr 2008
Rate this:
Please Sign up or sign in to vote.
Display RSS results that contain specific keywords.


Using RSS feeds on web pages is a good way of creating dynamic content, which search engines love. The more your page changes, the more it gets crawled, and can affect your page rank.

However, just because you point your RSS reader to a feed, doesn't necessarily mean you'll get relevant content on that feed, a problem that is remedied by this control.


This control came out of working on a similar control, RSS/XML Data-Binding to Data Control with Row Limitations.

Using the code

Using this control is quite simple. Simply place the code in your ~/Controls folder, drag it onto your .aspx page, and you're good to go. It does, however, require some configuration, usually in the PageLoad() method, either in the code-behind, or directly in your .aspx page.

Since we're interested in keyword matching, we provide the control with a list of keywords we would like to see in the RSS titles. Since one feed may not suffice, we can also provide a comma-delimited list of RSS sources (URLs) to retrieve content from.

RssReader1.SourceRss = 
            "" + 
            "amp;q=carbon+offset&ie=UTF-8&output=rss, http://news.go..."
RssReader1.TitleKeywords = "global warming,carbon footprint,global warming...
RssReader1.RowsToDisplay = 20;
RssReader1.Width = 300;
RssReader1.ShowLinks = true;
RssReader1.ShowTitles = true;
RssReader1.ShowDescriptions = false;
RssReader1.RowDivider = "";
RssReader1.UseTitleBullets = true;


In the example above, we want to ensure that keywords such as {carbon footprint, biodeisel, global warming} exist... which, they do ;).

One great thing about this control is you could end up grabbing content and inserting RSS titles directly within paragraphs of your own content. This is achieved by setting ShowLinks=false, ShowTitles=true, ShowDescription=false. You would also probably want to limit the number of rows (RSS titles) to display down to one or two.

Displaying the contents of the control can be done in either a DataGrid or simple text, where you can display the results in a bulleted or non-bulleted format, configured through the UseTitleBullets parameter.

Title length

As in the example above, you may want to limit the length of the titles in order to fit in a given area. Setting the TitleLength parameter will truncate each title at the last word, adding " ..." at the end. What the control does not check for, however, is if any of your keywords exist in the non-truncated text. This is a simple thing to add if you really need to, but chances are that you don't want the titles to be too short, anyway.

Points of interest

Since you can provide an unlimited number of RSS source URLs, and the code has to scan through the content of each one, be vigilant of page load times - don't add too many URLs, as the delay will increase your page visitor's frustration, and possibly not even bother waiting for the page to load.

I've tested this with 15 URLs and a whole slew of keywords, and processing has been quite prompt.


None yet!

Don't forget to vote for this article!


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Systems Engineer
United States United States
I am a technical architect/senior software engineer, technical trainer, entrepreneur.

I have worked in several sectors from healthcare, to entertainment and global intelligent traffic systems, using .Net, SQL, NoSQL and some of the latest technologies to deliver quality software systems for clients.

Past tech flavors include C#, WCF, SOA, MVC, MVVM, Silverlight, Assembler, Pascal, VB, Java/J2EE/EJB/JDBC, Perl, NLTK, TSQL, NoSQL, KendoUI, NodeJS, SignalR, Backbone JS, Angular JS, Latest .Net technologies, Amazon AWS...

You may also be interested in...


Comments and Discussions

QuestionAdd feeds other than Google Pin
fab@fab-silva.com9-Apr-09 8:52
memberfab@fab-silva.com9-Apr-09 8:52 
GeneralWrap the lines in the PRE blocks. Pin
Shog918-Apr-08 14:24
sitebuilderShog918-Apr-08 14:24 

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

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

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web04-2016 | 2.8.181117.1 | Last Updated 18 Apr 2008
Article Copyright 2008 by xbadenx
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid