RSS C# Class

Sometimes I love C#/Visual Studio/ASP.NET.  Then other times, not so much.

I wanted to create a simple RSS feed for my C#/ASP.NET site and there really wasn’t anything out there.  I really don’t want to download anybody else’s binary files and I wanted something simple.

It was almost super easy.  Then I got hung up on UTF-16 vs UTF-8.

So I made my own RSS class.  Here it is. RSS CLASS

It’s only about 100 lines.

If you want to have an RSS Feed on a .Net web page, here’s the code for that.

protected void Page_Load(object sender, EventArgs e)
{
    RSS rss = new RSS(“Geiger”, “http://www.jaygeiger.com”, “Geiger”, DateTime.Now.ToShortDateString());
    rss.Add(“Geiger 1″, “http://www.jaygeiger.com/1″, “Geiger Description 1″, “1″);
    rss.Add(“Geiger 2″, “http://www.jaygeiger.com/2″, “Geiger Description 2″, “2″);

    Response.Clear();
    Response.ContentType = “text/xml”;
    Response.Write(rss.Write(););
    Response.End();
}

Google LOVES blogs.  So if you have a .net site, add RSS to it!

Leave a Reply

Your email address will not be published. Required fields are marked *


+ 5 = ten

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>