BlogEngine.Net and FeedFlare Extension Bug

by Codewiz51 July 09, 2008 20:01

I use Feedburner for syndicating my RSS Feed. I downloaded FeedFlare to assist me with the tracking code. However, I noticed the logic used by the author does not work if you have a "/" character in your name.  My feeds look like http://feeds.feedburner.com/codewiz51/blog1, blog2, ... The original FeedFlare.cs code assumed everything after the last slash was the name.  Here are the code changes:

// Old Code
// This code will not parse http://feeds.feedburner.com/codewiz51/oldblog correctly.
// FeedBurnerUsername is parsed as oldblog, which is incorrect.
// My feeds are stored as http://feeds.feedburner.com/codewiz51/oldblog
// and http://feeds.feedburner.com/codewiz51/newblog
if (FeedBurnerUrl.EndsWith("/")) FeedBurnerUrl = FeedBurnerUrl.Remove(FeedBurnerUrl.Length - 1);
string FeedBurnerUsername = FeedBurnerUrl.Substring(FeedBurnerUrl.LastIndexOf("/") + 1);
e.Body = e.Body + string.Format(FeedBurnerScript, FeedBurnerUsername, AbsoluteUrl);

The fixed code looks for the url "http://feeds.feedburner.com/" and assumes anything after the string is part of the Feedburner name:

// New Code
// This code will parse http://feeds.feedburner.com/codewiz51/oldblog correctly.
// FeedBurnerUsername is parsed as codewiz51\oldblog, which is correct.
if (FeedBurnerUrl.EndsWith("/")) FeedBurnerUrl = FeedBurnerUrl.Remove(FeedBurnerUrl.Length - 1);
string FeedBurnerBase = "http://feeds.feedburner.com/";
string FeedBurnerUsername = FeedBurnerUrl.Substring(FeedBurnerUrl.IndexOf(FeedBurnerBase) + FeedBurnerBase.Length);
e.Body = e.Body + string.Format(FeedBurnerScript, FeedBurnerUsername, AbsoluteUrl);

Simply make changes to the Feedburner.cs file.  Then "jiggle" your Web.Config file to make the program restart.  After the recompile, you should see the correct FeedFlare url in the html.  Just select view->page source while viewing your blog.

Happy Blogging!

Comments are closed

Powered by BlogEngine.NET 1.6.0.0
Theme by Mads Kristensen | Modified by Mooglegiant

Disclaimer

This blog represents my personal hobby, observations and views. It does not represent the views of my employer, clients, especially my wife, children, in-laws, clergy, the dog, the cats or my daughter's horse. In fact, I am not even sure it represents my views when I take the time to reread postings.

© Copyright 2008-2011