I was reading blogs.msdn.com (again) and Alex Barnett was talking about how he isnt on the RSS band wagon yet.
http://blogs.msdn.com/alexbarn/archive/2005/03/19/399078.aspx
Well I decided I should be more on it. So I added an RSS feed for my videos for CIS410 as well as CIS349.
You can syndicate them by checking here:
http://www.jasncab.com/DeVry/cis349/rss.aspx
http://www.jasncab.com/DeVry/cis410/rss.aspx
I have validated them using http://start.com/1, so I think they should be ok.
I dont post videos that often, but at least this is n easy way to access them. I already had the video list in XML, so loading that XML into a Dataset was easy and then manipulating my existing RSS code to match the fields in the RSS was simple. Here is the code for the RSS. I admit I used an online resource for which I no longer have the link- sorry.
Imports System.Data.OleDb
Imports System.Xml
Imports System.Text
Imports System.IO
Public Class CIS410rss
Inherits System.Web.UI.Page
#Region ” Web Form Designer Generated Code “
‘This call is required by the Web Form Designer.
End Sub
‘NOTE: The following placeholder declaration is required by the Web Form Designer.
‘Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
‘CODEGEN: This method call is required by the Web Form Designer
‘Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
‘Put user code to initialize the page here
Response.ContentType = “text/xml”
Response.ContentEncoding = Encoding.UTF8
‘ build up the cache dynamically
Dim articleData As DataSet = CreateDataSource()
Dim i As Integer
‘ Use an XmlTextWriter to write the XML data to a string…
Dim sw As New StringWriter
Dim writer As New XmlTextWriter(sw)
‘ write out
writer.WriteStartElement(“rss”)
writer.WriteAttributeString(“version”, “2.0″)
‘ write out
writer.WriteStartElement(“channel”)
‘ write out
writer.WriteElementString(“title”, “Jasncab Video Blog”)
writer.WriteElementString(“link”, “http://www.jasncab.com/cis410″)
writer.WriteElementString(“description”, “Janscab Video Blog for CIS 349 (database Intro)”)
writer.WriteElementString(“ttl”, “60″)
‘ write out an
For i = 0 To articleData.Tables(0).Rows.Count – 1
‘ write out
writer.WriteStartElement(“item”)
‘ write out
writer.WriteElementString(“title”, articleData.Tables(0).Rows(i).Item(“name”).ToString())
If Not Left(Request.ServerVariables(“remote_addr”),
= “204.249.” Then
writer.WriteElementString(“link”, String.Format(“http://www.jasncab.com/devry/cis410/{0}”, articleData.Tables(0).Rows(i).Item(“relativelink”)))
Else
writer.WriteElementString(“link”, String.Format(“{0}{1}”, Application(“devryvideolocation”), articleData.Tables(0).Rows(i).Item(“relativelink”)))
End If
writer.WriteElementString(“description”, articleData.Tables(0).Rows(i).Item(“longdescription”).ToString())
writer.WriteElementString(“author”, “Jason Huber “)
‘ use DateTimeFormatInfo “r” to use RFC 1123 date formatting (same as RFC 822)
writer.WriteElementString(“pubDate”, articleData.Tables(0).Rows(i).Item(“pubdate”).ToString())
‘ write out
writer.WriteEndElement()
Next
‘ write out
writer.WriteEndElement()
‘ write out
writer.WriteEndElement()
writer.Close()
‘ write out the cached value
Response.Write(sw.ToString())
End Sub
Private Function CreateDataSource() As DataSet
‘get the data
Dim DS As New DataSet
DS.ReadXml(MapPath(“videos.xml”))
Return DS
End Function
End Class
Trackback • Posted by Jason in Uncategorized category
Please leave a reply...