roncli.com blog
The blog of roncli
roncli.com blog
roncli.com
blog
Profile
roncli
Houston, Texas, United States
Labels
Coding
CTG Music
Editorials
Games
Miscellaneous
Music
Servers
Silliness
Software
Sports
Trax in Space Beta
Weather
Recent Posts
WTF did Revival Productions just do?
A Tale of Two Communities
The Final Stretch
A Two Tiered, Untiered OTL
Secretly, you wish you could've done what I did
What have I done since roncli.com v2?
It's Done. It's Finally Done.
The Big Picture is Starting to Wear on Me
A Low Bang to Buck Ratio
win-acme
Archives
February 2005
March 2005
April 2005
May 2005
June 2005
July 2005
August 2005
September 2005
October 2005
November 2005
December 2005
January 2006
February 2006
March 2006
April 2006
May 2006
June 2006
July 2006
August 2006
September 2006
October 2006
November 2006
December 2006
February 2007
March 2007
April 2007
May 2007
June 2007
July 2007
August 2007
September 2007
October 2007
November 2007
December 2007
January 2008
February 2008
March 2008
April 2008
June 2008
July 2008
September 2008
December 2008
February 2009
July 2009
August 2009
September 2009
October 2009
November 2009
February 2010
March 2010
April 2010
June 2010
July 2010
August 2010
September 2010
October 2010
November 2010
December 2010
March 2011
June 2011
July 2011
August 2011
September 2011
October 2011
December 2011
January 2012
February 2012
April 2012
July 2012
November 2012
July 2013
April 2014
July 2014
August 2014
November 2014
December 2014
March 2015
April 2015
May 2015
June 2015
July 2015
September 2015
January 2016
February 2016
May 2016
July 2016
November 2016
March 2017
January 2018
May 2018
June 2018
January 2019
January 2021
February 2021
March 2021
August 2021
October 2021
December 2021
August 2022
November 2022
October 2023
February 2024
April 2024
Tuesday, September 01, 2009
FeedPage
Posted: 1:48:00 PM 0 comments
Because the code is so short, I've decided to just go ahead and post the code to FeedPage here. Remember, you must have a reference to the ASP.Net RSS Toolkit in order to compile this.

Imports RssToolkit.Rss
Imports System.Web.UI

Namespace roncliProductions.LibFeedPage

Public MustInherit Class FeedPage
    Inherits Page

    Protected Overrides Sub OnPreInit(ByVal e As System.EventArgs)
        MyBase.OnPreInit(e)
        Dim strFeed As String = Request.QueryString("feed")
        If Not String.IsNullOrEmpty(strFeed) Then
            If strFeed = "atom" Or strFeed = "opml" Or strFeed = "rdf" Or strFeed = "rss" Then
                Response.ContentType = "text/xml"
                Select Case strFeed
                    Case "atom"
                        Response.Write(GetFeed().ToXml(DocumentType.Atom))
                    Case "opml"
                        Response.Write(GetFeed().ToXml(DocumentType.Opml))
                    Case "rdf"
                        Response.Write(GetFeed().ToXml(DocumentType.Rdf))
                    Case "rss"
                        Response.Write(GetFeed().ToXml(DocumentType.Rss))
                End Select
            End If
            Response.End()
        End If
    End Sub

    Protected MustOverride Function GetFeed() As RssDocument

End Class

End Namespace


Easy enough. To use, simply change your inheritance from System.Web.UI.Page to roncliProductions.LibFeedPage.FeedPage, and inside that construct and return an RssDocument object. Then, when you add ?feed=xml to the URL of the page, you will get an RSS feed.

Labels: , , ,

Fastest. Project. Evar.
Posted: 12:56:00 AM 0 comments
I've decided that I'm going to write a website that combines my three main personal sites: Projects, roncli.com, and this blog.

One of the biggest features of this site is the ability to easily add an RSS feed to a webpage without having to write separate pages or nasty ASP.Net http handlers. Basically what I wanted was to have URL's that look like "...page.aspx" load the usual aspx, but "...page.aspx?feed=rss" load the RSS feed instead of the normal page.

This idea led me to the ASP.Net RSS Toolkit, a very easy to use toolkit with some nice features. Including the ability to quickly make RSS feeds. That, combined with a 34-line class (counting 6 blank lines) that inherits from System.Web.Ui.Page, overrides OnPreInit, and forces inheriting classes to override a GetFeed function, and I'm ready to create feeds not only in RSS, but also Atom, OPML, and RDF as well.

Wow. The demo app was more challenging to write than this gem.

I want to give it a test run, probably on some Six Minutes To Release pages, and see if it's stable. However, shortly thereafter I will probably release this to CodePlex so that other people can get their hands on it. I am rapidly becoming addicted to RSS feeds since my iPhone reads em pretty good using Byline. I have feeds from all over the Internet, and it's nice to be able to have one central place to find out what's going on in my own little corner of the world.

Labels: , , , , , , ,