Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

RSS Feed Reader

Posted on April 8, 2013October 26, 2015 By David Kittell
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class test_special_rssreader : System.Web.UI.Page
{

	public void ProcessRSSItem(string rssURL)
	{

		string rowcolor = "#ffffff";

		System.Net.WebRequest myRequest = System.Net.WebRequest.Create(rssURL);
		System.Net.WebResponse myResponse = myRequest.GetResponse();

		System.IO.Stream rssStream = myResponse.GetResponseStream();
		System.Xml.XmlDocument rssDoc = new System.Xml.XmlDocument();
		rssDoc.Load(rssStream);

		System.Xml.XmlNodeList rssItems = rssDoc.SelectNodes("rss/channel");

		System.Xml.XmlNode rssDetail;

		string title = "";
		string link = "";
		string description = "";

		for (int i = 0; i < 1; i++)
		{
			//rssDetail = rssItems.Item

			rssDetail = rssItems.Item(0).SelectSingleNode("title");

			if (rssDetail != null)
			{
				title = rssDetail.InnerText;
				if (title.StartsWith((i + 1).ToString()))
					title.Insert(0, (i + 1).ToString());
			}

		}

		rssItems = rssDoc.SelectNodes("rss/channel/item");



		Response.Write("<table cellpadding='2' cellspacing='0' style='width:200px; border:1px solid #f68f16;'>");
		Response.Write("<tr style='background-color:#f68f16'><td><strong>" + title + "</strong></td></tr>");

		//for (int i = 0; i < rssItems.Count; i++)
		for (int i = 0; i < 10; i++)
		{

			rssDetail = rssItems.Item(i).SelectSingleNode("title");
			if (rssDetail != null)
			{
				title = rssDetail.InnerText;
				if (title.StartsWith((i + 1).ToString()))
					title.Insert(0, (i + 1).ToString());
			}


			rssDetail = rssItems.Item(i).SelectSingleNode("link");
			if (rssDetail != null)
			{
				link = rssDetail.InnerText;
			}


			rssDetail = rssItems.Item(i).SelectSingleNode("description");
			if (rssDetail != null)
			{
				description = rssDetail.InnerText;
			}


			title = title.Replace("#", "");
			title = title.Replace(":", ".");

			Response.Write("<tr style='background-color:" + rowcolor + "'><td>");
			Response.Write("<a target='_blank' style='color:#0000ff' href='" + link + "'>" + title + "</a>");
			Response.Write("</td></tr>");

			if (rowcolor == "#ffffff")
			{
				rowcolor = "#cccccc";
			}
			else
			{
				rowcolor = "#ffffff";
			}
		}

		Response.Write("</table>");
	}


	protected void Page_Load(object sender, EventArgs e)
	{
		string feedurl = Request.QueryString["url"];

		ProcessRSSItem(feedurl);

	}
}
Originally Posted on April 8, 2013
Last Updated on October 26, 2015
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.

Related

Code CSharp

Post navigation

Previous post
Next post

Related Posts

FormatDateTime Function

Posted on August 21, 2013October 26, 2015

This is a default function within VBScript that should work in any VBScript situation. FormatDateTime(date,format) Date is required and has to be in a valid format but easily can accept date() or now() Date() would only display the current date where now() would be date and time. Format would be…

Read More

Ektron Find Replace In Content Html

Posted on October 23, 2013October 26, 2015

This script will search and replace specific content/phrases through the entire content table. This script can be modified to handle different scenarios as well. /* search/replace script to replace characters in the content fields of the content_text and content_teaser fields  = *space* €“ = — €™ = ‘ €¢…

Read More

Draw An Arrow

Posted on December 20, 2013October 26, 2015

Imports System.Drawing Imports System.Drawing.Drawing2D Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub Form1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint Dim grp As Graphics = e.Graphics Dim TempPen As New Pen(Color.Aqua, 10) TempPen.StartCap = Drawing2D.LineCap.ArrowAnchor grp.DrawLine(TempPen, 100,…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions
  • Open On Screen Keyboard (OSK)
  • SQLite - Auto-Increment / Auto Generate GUID
©2025 David Kittell | WordPress Theme by SuperbThemes