Creating an RSS Reader Using ASP.NET and LINQ – Part 2

Back in Part 1, we put together the first part of our application. We defined a list of RSS feeds and pulled in the list into a drop-down list box. In this post, we’ll get our selection from the user and build a list of atricles from the RSS feed data.

Entry Data Storage

The first step is to decide what data we want to display. In our example, we’ll display the following fields:

  • Title
  • Published Date
  • Tags

Along with these fields, we’ll need to know the entry’s URL so that we can allow the user to display the blog entry. As with the feed definitions, we’ll store this information in a basic class:

public class BlogEntryDefinition
   public string Title { get; set; }
   public string Url { get; set; }
   public IEnumerable Tags { get; set; }
   public DateTime Published { get; set; }

Getting The User’s Selection

Before we can process the feed data, we need to know what feed the user wants to display. In our display, we placed an Open button next to our combo box. When the user presses this button, this will let our program know when to process the selection.

We must fist update our display code for the button, specifying an event handler method that will be called when the user clicks on the button. We do this by specifying a method name for the OnClick parameter:

<asp:Button ID="OpenButton"
            runat="server" />

Back in our code-behind, we need to define the method:

protected void OpenButton_OnClick(object sender, EventArgs e)

When the user clicks on the button, this method will be called. The sender parameter will be the object that initiated the OnClick event, in this case our button, and the e parameter will contain the arguments for the event. In our example, we won’t use these parameters.

Loading The Blog Entry Definitions

To load up the list of blog entries, we process the data in the same way that we did when we loaded up our feed definitions. The only difference is that rather than getting the data from a file on our web server, we are loading the data from a URL. We get the URL from our drop-down list box control through the SelectedValue property:

XDocument rssFeed = XDocument.Load(FeedList.SelectedValue);
var posts = from item in rssFeed.Descendants("item")
select new BlogEntryDefinition()
   Title = (string)item.Element("title"),
   Url = (string)item.Element("link"),
   Published = DateTime.Parse((string)item.Element("pubDate")),
   Tags = from category in item.Elements("category")
          orderby (string)category
          select (string)category

Building The Display

There are multiple ways in which you could display the data. In our example, we’ll use a grid view control. We’ll manually define the columns of the control so that we can specify custom cell values:

<asp:GridView ID="FeedDetailsGrid"
                    <%#Eval("Published", "{0:G}") %>
                    <a href='<%#Eval("Url") %>' target="_blank"><%#Eval("Title") %></a>
                    <asp:Repeater ID="TagRepeater"
                                  DataSource='<%#Eval("Tags") %>'
                        <%#Container.DataItem %>

Putting It Together

First we handled the processing when the user clicked on the Open button. Then we built a display to contain all the data. Now, we need tell our grid view control what data it will be displaying. This process is the same as it was with the drop-down list box control:

FeedDetailsGrid.DataSource = feeds;

Now, when we click on the Open button, we get a nicely formatted grid with the list of blog entries from the selected feed:


As you’ve seen through these two posts, with just a little bit of code and a few screen controls, you can create a simple RSS reader. ASP.NET gives you a simple framework to leverage the .NET Framework to create a feature-rich website.

Creating an RSS Reader Using ASP.NET and LINQ – Part 1

With every release of the .NET Framework, more power has been placed in the developer’s hands.  We can now concentrate on the overall process of our applications rather than developing the low-level functionality.  In this post, I’ll start creating a simple RSS reader using ASP.NET and LINQ.

Feed Definitions

The first step is to decide how to define the RSS feed information and how our program will use it.  The basic information we’re going to need will be:

  • The name of the feed.
  • The URL of the feed.

For ease of maintenance, and to allow updating the list without having to edit our source code, we’ll store the feed definitions in an external file.  There are many options for this and we’ll use the easiest option: XML.  Our file will have a basic format, only storing the basic information that we need:

<!--?xml version="1.0" encoding="utf-8" ?-->
    <Name>Stuck In Customs</Name>
    <Name>2000 Things You Should Know About C#</Name>
    <Name>There, I Fixed It!</Name>

We’ll store this information in a basic class:

public class FeedDefinition
   public string Name { get; set; }
   public string Url { get; set; }


Loading the Feed Definitions

Now that we have our feed definitions stored in an external file and a class defined to store the information, we need to load that data into our application. Before we had the .NET Framework, we would have to read in the file and create our own XML parser in order to load the data. This process has become easier with each version of the .NET Framework.

By utilizing LINQ, the process of obtaining the data from an XML file has become quite easy:

XDocument feedDefinitions = XDocument.Load(Server.MapPath("Feeds.xml"));
var feeds = from feed in feedDefinitions.Descendants("Feed")
select new FeedDefinition()
  Name = (string)feed.Element("Name"),
  Url = (string)feed.Element("Url"),

Using just one line of code (line 1), the entire feed definition file is loaded and parsed for you. The contents are stored in an XDocument object.  Processing this object using LINQ (lines 3-8), we obtain a collection of FeedDefinition objects (IEnumerable<FeedDefinition>) that we will use in our web page.

Building The Display

Now that we have our data, we need to be able to display it to the user. We will use a drop-down list control that will allow the user to select a feed for reading. In our ASP.NET content page, we’ll define the our display as this:

<div class="feedList">
<asp:DropDownList ID="FeedList"
                  runat="server" />
<asp:Button ID="OpenButton"
            runat="server" />

The drop-down list box will be bound to our feed data that we read in earlier. However, we have two fields in our data. Using the DropDownList control, we can display the Name property to the user and use the Url property for processing later on.

Putting It Together

Now that we have our feed definitions and our display, we just need to put them both together:

FeedList.DataSource = feeds;


This code binds our feed definition collection to the drop-down list control. All we need to do now is put our code into our content page’s Page_Init method so that it’ll populate our control the first time our page is loaded.

protected void Page_Init()
XDocument feedDefinitions = XDocument.Load(Server.MapPath("Feeds.xml"));
var feeds = from feed in feedDefinitions.Descendants("Feed")
select new FeedDefinition()
   Name = (string)feed.Element("Name"),
   Url = (string)feed.Element("Url"),
FeedList.DataSource = feeds;

It’s important that you load the feed definitions in Page_Init() rather than in Page_Load().  Putting them in Page_Init() will prevent the drop-down list control from getting reinitialized during postback when we implement our Open button in Part 2.

When we load our website, we get our list of feeds neatly displayed in our control:


In this post, we wrote the first half of our simple RSS reader web application. By using the .NET Framework and the LINQ feature, we were able to load a list of RSS feeds into our web page without writing a lot of code.

In part 2, we’ll show how to get a list of posts from the feed and display them along with other data related to the posts.

Boom Boom, Out Go The Lights

Shortly before 6am, those of us who live in Southwest Florida were treated, once again, to the signature “Boom Boom” from the space shuttle after another successful mission into space.  This is one of the many benefits that we get in this part of the country.

I remember the first time I heard the double sonic booms.  It rattled my whole house and my reaction was “WHAT WAS THAT!!!!”  I thought someone had set off an explosion and used a little bit too much nitro.  Then, I came to my senses and realized that the space shuttle was returning and that the sound I heard was the double sonic booms that I had heard so much about.

This morning, although it was a sweet sound to hear, it was also bitter.  This was the last time that I will ever hear that sound.  Today was the last time that a space shuttle will ever land because the entire program has been shut down.  For thirty years, the space shuttle has been the workhorse of our space program.  For most people in this country, the space shuttle is all that they know.

Sadly, there is no program that is ready to take its place.  For the foreseeable future, the United States will have to rely on other countries to get humans into space.  Much of the technology that exists in our society, from food preservation to computers, traces its roots back to NASA and the space program.  Many industries were formed as a result of the space program in the past forty years since the first Mercury flight in 1959.

Another sad result of the cancellation of the shuttle program is the hundreds of people connected with the program at NASA that are being laid off.  When you combine this with even more that will suffer the same fate at companies that are connected with the program, many thousands will loose their jobs during one of the worst economic times in our country.  This will have a drastic effect on our technology programs and our economics.

The NASA budget is just a small fraction of the budget of this country.  Yet, the economic benefit that has resulted from it more than pays for the program.  The “Return on Investment” from the NASA budget far exceeds that from any other budget item, including education, welfare and other pork projects that our “elected” leaders come up with.

My hope is that someday we will return to space.  The benefits of the space program far out-weigh the risks.

SUPER BOWL: Aaron Rodgers, other Packers, looking to ‘follow Jesus’ example’

 Originally Posted February 2, 2011 in the Baptist Press

Posted on Feb 2, 2011 | by Art Stricklin

ARLINGTON, Texas (BP)–NFL experts and newspaper headline writers have been quick to label Green Bay starting quarterback Aaron Rodgers the "Leader of the Pack."

Something about 4,712 yards passing and 34 touchdowns, and leading the Packers to the verge of their first Super Bowl title in more than a decade will do that for you.

But Rodgers made it clear in Tuesday’s jam-packed Super Bowl XLV Media Day he only wants to be a leader of God’s pack when it comes to influencing others to see his faith in Jesus Christ.

"We all have a platform, we all have a message in our lives," Rodgers told Baptist Press and a worldwide media turnout, which ringed his individual interview area. "I just try to follow Jesus’ example, leading by example."

During his six years with the Packers, his career has seen enough twists and turns, dead ends and detours to test anyone’s faith. An expected top 10 draft choice, he lasted until the end of the first round for reasons he never understood. He stood on the sidelines for three seasons while Packers quarterback Brett Favre went through his yearly will-he-or-won’t-he retirement routine as Packers QB.

Finally given a chance to start three years ago, he has matured into one of the top quarterbacks in the league, but not forgetting his past, present and future in Christ.

"God always has a plan for us, a path. Sometimes we wish we knew it sooner," Rodgers said with a bit of a laugh, "but He always shows up His way."

He credits his parents, Ed and Darla Rodgers, who still live in Northern California where he was raised, for showing him a loving and Christ-centered household. He also remains close to his two longtime accountability partners, Pastors Andrew Burchett of the Neighborhood Church in Chico, Calif., and Young Life Christian youth group leader Matt Hock.

Even in the midst of the craziness of Super Bowl week and Tuesday’s Media Day at Cowboys Stadium, Rodgers had already checked in with his accountability team.

"They won’t be here Sunday, but they’ve been calling and texting me," he said. "Matt sent me a photo of his entire Young Life group decked out in Packers gear."

Rodgers’ quiet and humble testimony has been enough to inspire Christian NFL fans everywhere and his own teammates as well.

Rookie defensive end C.J. Wilson, whose father is a Pentecostal minister in Mt. Olive, N.C., said he really didn’t know what to expect when he showed up for his first NFL season this year. But when he saw the experience of his star quarterback and his witness, Wilson felt encouraged with his own professional football faith.

"I think it does help when your superstar quarterback is walking with God. I’ve been blessed to be around him and see how God makes all things possible in our lives," Wilson said.

Packers wide receiver Greg Jennings is one of Rodgers’ receivers and teammates on the field, but more importantly, a spiritual brother on and off the field. He said he’s determined to let Sunday’s game against the Pittsburgh Steelers be his platform for God.

"I just want to let people know what it’s all about. One of the Scriptures I refer to a lot is, ‘to whom much is given, much is required,’ and I’m required to have a voice [for God] because I have a stage and a platform," Jennings said.

"Number one, all glory goes to God. That’s where it starts and that’s where it finishes."

His father, Greg, Sr., is the pastor of Progressive Deliverance Ministries in Kalamazoo, Mich.

Packers defensive tackle Ryan Pickett has been inspired to join an anti-pornography campaign in the NFL this year to help rid the destructive influence among his friends and teammates. He said he had to turn down the invitations of his teammates this week and other times who wanted him to go places he knew was not right.

"I value my family and my wife. I try to stay away from that," Pickett said.

Green Bay kicker Mason Crosby doesn’t have to be reminded about the number of Super Bowl games which have come down to a final touchdown or field goal, including the last Super Bowl held in Texas when the New England Patriots won on a last-second kick in Houston.

But he said his faith in Christ won’t allow him to be defined by a single kick.

"I think He helps me knowing that kicking is what I do, not who I am. It’s not everything that I am. I can escape knowing that my relationship with Christ is what carries me."

Crosby has also noticed his quarterback’s faith and his example to his teammates and the sports world.

"Aaron has a great relationship with the Lord," Crosby said. "He’s the face of the franchise and it helps to see he’s living the message all of the time.

"I’m always reading in the Proverbs and Psalms to relax my mind before we play," Crosby added. "I know that God cares for me all the time regardless of any outcome here."


Art Stricklin is a Dallas-based sports correspondent. With reporting by Jerry Pierce, managing editor of the Southern Baptist TEXAN (, newsjournal of the Southern Baptists of Texas Convention.



 A guy cruises through a stop sign,and gets pulled over by a local policeman.  Guy hands the cop his driver’s license, insurance verification, plus his concealed carry permit.

"Okay, Mr. Smith," the cop says, "I see your CCW permit. Are you carrying today?"

"Yes, I am."

"Well then, better tell me what you got."

Smith says, "Well, I got a .357 revolver in my inside coat pocket. There’s a 9mm semi-auto in the glove box. And, I’ve got a .22 magnum derringer in my right boot."

"Okay," the cop says. "Anything else?"

"Yeah, back in the trunk, there’s an AR15 and a shotgun. That’s about it."

"Mr. Smith, are you on your way to or from a gun range…?"


"Well then, what are you afraid of…?"

"Not a thing…"

Which Side Of The Fence Are You On?

If you ever wondered what side of the fence you sit on, this is a great test.

  • If a conservative doesn’t like guns, he doesn’t buy one.  If a liberal doesn’t like guns, he wants all guns outlawed.
  • If a conservative is a vegetarian, he doesn`t eat meat.  If a liberal is a vegetarian, he wants all meat products banned for everyone.
  • If a conservative is homosexual, he quietly leads his life.  If a liberal is homosexual, he demands legislated respect.
  • If a conservative is down-and-out, he thinks about how to better his situation.  A liberal wonders who is going to take care of him.
  • If a conservative doesn’t like a talk show host, he switches channels.  Liberals demand that those they don’t like be shut down.
  • If a conservative is a non-believer, he doesn’t go to church.  A liberal non-believer wants any mention of God and religion silenced. (Unless it’s a foreign religion, of course!)
  • If a conservative decides he needs health care, he goes about shopping for it, or may choose a job that provides it.  A liberal demands that the rest of us pay for his.
  • If a conservative reads this, he’ll forward it so his friends can have a good laugh.  A liberal will delete it because he’s “offended”.

Project 365 – 2010: Day 26


When you live out in the country, you have to deal with the wildlife.  On a regular basis we are visited by a black bear that takes a liking to our trash.  Who knew that trash could result in a photograph?!

Photo details: Exposure time 1/10 sec, Aperture f/4.5, Focal Length 34mm, ISO-200, Lens Nikon AF-S Nikkor 18-55mm 1:3.5-5.6 G II ED, Camera Nikon D40X. 


Project 365 – 2010: Day 19

This is the most intense drummer that I have seen.  This shot came out interesting with the effects lighting reflecting off of the shield in front of the drum kit.

Photo details: Exposure time 1/40 sec, Aperture f/5.6, Focal Length 200mm, Lens Nikon AF-S Nikkor 55-200mm 1.4-5.6 G ED, Camera Nikon D40X.

Project 365 – 2010: Day 18

This was the first SLR camera that I owned and the camera started it all.  It was originally owned by my mother and her photography work with it got me started.

Photo details: Exposure time 1/60 sec, Aperture f/4.8, Focal Length 38mm, ISO-200, Lens Nikon AF-S Nikkor 18-55mm 1:3.5-5.6 G II ED, Camera Nikon D40X.

How You Fix Congress

Congressional Reform Act of 2010


1. Term Limits: 12 years only, one of the possible options below.

A. Two Six year Senate terms

B. Six Two year House terms

C. One Six year Senate term and three Two Year House terms

Serving in Congress is an honor, not a career. The Founding Fathers envisioned citizen legislators, serve your term(s), then go home and back to work.

2. No Tenure / No Pension:

A congressman collects a salary while in office and receives no pay when they are out of office.

Serving in Congress is an honor, not a career. The Founding Fathers envisioned citizen legislators, serve your term(s), then go home and back to work.

3. Congress (past, present & future) participates in Social Security:

All funds in the Congressional retirement fund moves to the Social Security system immediately. All future funds flow into the Social Security system, Congress participates with the American people.

Serving in Congress is an honor, not a career. The Founding Fathers envisioned citizen legislators, server your term(s), then go home and back to work.

4. Congress can purchase their own retirement plan just as all Americans.

Serving in Congress is an honor, not a career. The Founding Fathers envisioned citizen legislators, serve your term(s), then go home and back to work.

5. Congress will no longer vote themselves a pay raise. Congressional pay will rise by the lower of CPI or 3%.

Serving in Congress is an honor, not a career. The Founding Fathers envisioned citizen legislators, serve your term(s), then go home and back to work.

6. Congress looses their current health care system and participates in the same health care system as the American people.

Serving in Congress is an honor, not a career. The Founding Fathers envisioned citizen legislators, serve your term(s), then go home and back to work.

7. Congress must equally abide in all laws they impose on the American people.

Serving in Congress is an honor, not a career. The Founding Fathers envisioned citizen legislators, serve your term(s), then go home and back to work.

8. All contracts with past and present congressmen are void effective 1/1/11 .

The American people did not make this contract with congressmen, congressmen made all these contracts for themselves.

Serving in Congress is an honor, not a career. The Founding Fathers envisioned citizen legislators, serve your term(s), then go home and back to work.