Kieron's Blog

RSS feed

This little piece of code I created shown below will allow you to use XPath to traverse the XML from an RSS feed and load the contents of the feed on your ASP.net web page.

Code In-Front:

<%@ Page Language=”VB” AutoEventWireup=”false” CodeFile=”RSSExternal.aspx.vb” Inherits=”RSSExternal” %>

<!DOCTYPE html>

<html xmlns=”http://www.w3.org/1999/xhtml”>
<head runat=”server”>
<title></title>
</head>
<body>
<form id=”form1″ runat=”server”>






</form>
</body>
</html>

Code Behind:

Imports System.Xml

Imports System.Xml.XPath
Imports System.Xml.Linq
Imports System.Linq
Imports System.Collections.Generic
Partial Class RSSExternal
Inherits System.Web.UI.Page

Public Class RSSFeed

Public Title As String
Public Description As String
Public Location As String
Public From As String
Public Till As String
Public Link As String
Public ImageSrc As String
Public ImageTitle As String
Public ImageLink As String

End Class

Protected Sub form1_Load(sender As Object, e As EventArgs) Handles form1.Load

If (Not Request.QueryString(“type”) Is Nothing) Then

Dim feedType As String = Request.QueryString(“type”)

If…

View original post 93 more words

Advertisements