Site Updates, Bug Fixes and Syndication in .NET 3.5
(
Apr 20 2008 - 08:07:23 PM by
Timothy Khouri) - [
print blog
post]
Minor Bug Fixes
There have been a few bugs and glitches that I've noticed since the recent rewrite. For starters, the Blogs RSS page wasn't linking to the blog posts. They were correctly displaying most recent blog entries, but the link was broken and would simply take you back to the front page of the site.
There was also a strange bug with the categories selector when writing an article. If you would edit your aritcle, and not change your selection of categories, then the next time you saved, the categories were blank... like I said, weird bug, but it's fixed now.
Minor Updates
Also, since I've recently learned about the System.ServiceModel.Syndication namespace, I've changed the RSS code to use these new classes for sending out the RSS feeds. Because of it, there is a new feature (well, not new, but I wasn't doing it before). Now the article's (or blog post's) categories are being sent too in the feed. This lets you sort or filter by a the category in your favorite RSS viewer!
Here's a snippet of the code that I'm using now. It's offers some easy RSS abilities in .NET:
System.ServiceModel.Syndication
using System.ServiceModel.Syndication;
public partial class MyRssPage : ContentPage
{
protected override void OnInit(EventArgs e)
{
this.Response.AppendHeader("content-type", "application/xml");
List<SyndicationItem> feedItems = new List<SyndicationItem>();
feedItems.Add(new SyndicationItem("Item One Title",
"Item one content here. <b>HTML Tags</b> are ok!",
new Uri("http://www.singingeels.com/ItemOne.aspx")));
SyndicationFeed feed = new SyndicationFeed("My RSS Feed!",
"My site description!!!",
new Uri("http://www.singingeels.com/RSS.aspx"),
feedItems);
XmlWriterSettings feedWriterSettings = new XmlWriterSettings();
feedWriterSettings.Indent = true;
feedWriterSettings.IndentChars = "\t";
XmlWriter feedWriter = XmlWriter.Create(this.Response.OutputStream, feedWriterSettings);
feed.SaveAsRss20(feedWriter);
feedWriter.Close();
this.Response.End();
}
}
Of course, you don't have to indent the XML either, but I like my source to look good :) The more I look into .NET 3.5, the more I love it!