Scott on Writing

Musings on technical writing...

FeedBurner and Changing a Blog's Feed URL

This weekend I moved over my RSS feed - previously http://ScottOnWriting.NET/sowBlog/Rss.aspx - to a feed managed by FeedBurner (http://feeds.feedburner.com/ScottOnWriting).  FeedBurner serves as a sort of feed URL proxy.  Basically you give FeedBurner a link to your RSS feed and it creates a feed based on that feed.  You then point your subscribers to the FeedBurner feed and FeedBurner serves up your site's content, maintains statistics on who's subscribing to your blog, and so on.

I decided to move to FeedBurner to realize three benefits (keep in mind that ScottOnWriting.NET (still) runs off of an old version of Scott Watermasysk's .Text blogging engine, as I've yet to upgrade to Community Server; previous to today, I was actually using a pre-0.94 version, but today "upgraded" to the official 0.94 release downloadable from the .Text GotDotNet Workspace):

  1. Subscription statistics - FeedBurner provides a number of free statistics, including number of subscribers, number of requests, and aggregator breakdown.
  2. Someone else handles the bandwidth - currently requests to the RSS feed on ScottOnWriting.NET consume roughly 1.5 GB of traffic per week, or 6 GB of traffic per month (in total, ScottOnWriting does about 11 GB of traffic per month).  That's a lot of 1s and 0s that would be nice to offload to another party.  (I don't believe the pre-0.94 version of .Text I was using supported conditional HTTP GETs (although if I'm not mistaken the "official" 0.94 release does; had I been using a version that supported conditional GETs this bandwidth requirement would be an order of magnitude lower, I'd wager, perhaps just a GB for the month.)  (To clarify, while FeedBurner does make requests to the blog's RSS URL, it caches the results for a period of time, thereby reducing the bandwidth demands for my server.)
  3. FeedBurner has a couple of neat “publicizing“ tools - FeedBurner includes a number of tools to easily make links to add your blog to My Yahoo!, MyMSN, newgator Online, and so on.  Additionally, there are nifty little tools you can use to “show off“ how many folks subscribe to your blog, a la:

When changing over your RSS feed URL the main challenge is making sure that your existing subscriber base starts to use the new feed URL.  There are, to my knowledge, to ways this can be done, with the first of the two ways being the ideal way:

  1. Have your old feed URL emit an HTTP 301 status code - The HTTP 301 status code is a message from the server to the client saying, “Hey, this resource has been permanently moved to URL xyz.“  The client, then, can make a new request to the specified URL; too, if there's some database being used to track the URL, this message informs the client that it's time to update the database and use the new location.  If I'm not mistaken, virtually all modern aggregators support HTTP 301 status codes and will automatically update a site's feed URL to use the newly specified location.
  2. Tell people of your new feed URL - if you do not have control over your blog website you may not be able to take the steps needed to replace the current feed URL with an HTTP 301 status code.  In this case, the only approach I know of to inform users of the new feed URL is simply through word of mouth.  That is, you'll just have to post on your blog an entry telling users to update their aggregators.  As Kent Sharkey has noted, though, the results may be somewhat disappointing.

Since I run ScottOnWriting.NET myself (well, through a web hosting company), I have control over these matters.  The only challenge, then, was getting .Text to play nice.  In .Text version 0.94 the site's RSS feed comes from a file named Rss.aspx.  This file, though, does not actually exist; rather, in the Web.config file all requests are handed off to a .Text HTTP Handler.  When a request comes in for Rss.aspx, .Text generates the appropriate output.

To get Rss.aspx replaced with an HTTP 301 status code, the first step is to create an Rss.aspx file in your blog's root directory.  The code needed for this page is alarmingly simple - all you want to do is return an HTTP 301 specifying the new feed URL, like so:

<script runat="server" language="C#">
void Page_Load(object sender, EventArgs e)
{
    Response.Status = "301 Moved Permanently";
    Response.AddHeader("Location", "
http://feeds.feedburner.com/ScottOnWriting");
}
</script>

(Of course replace the http://feeds.feedburner.com/ScottOnWriting Location header value with the URL of your new RSS feed...)

Creating this file is not enough.  In fact, even after creating this file if you visit Rss.aspx through your browser you'll still see the complete RSS feed rather than being auto-redirected to the specified URL.  This is because the ASP.NET engine is handing off the request to the .Text HTTP Handler rather than handling the request itself.  If you look at the <httpHandlers> section in the Web.config file you'll find an entry like:

<add verb="*" path="*.aspx" type="Dottext.Framework.UrlManager.UrlReWriteHandlerFactory,Dottext.Framework" />

This entry says, “Any request for an ASP.NET page should be handled by the class Dottext.Framework.UrlManager.UrlReWriteHandlerFactory,Dottext.Framework,” and HTTP Handler. This includes requests for Rss.aspx.  Hence we need to add the following line to the <httpHandlers> section:

<add verb="*" path="Rss.aspx" type="System.Web.UI.PageHandlerFactory" />

That tells the ASP.NET engine to take care of requests to Rss.aspx.  At first I naively thought that I was done, but I had just unwittingly setup an infinite loop!  When a request comes into Rss.aspx, it sends back a 301 status code to the client, saying, “No, no, no, you want to go to this FeedBurner URL.“  This is what we want to tell people coming through a browser or aggregator, but remember that FeedBurner also needs to know the URL of the site's feed, which, at this point, I had set simply as Rss.aspx!  So when FeedBurner periodically checked to see if a new version of my feed was available it requested Rss.aspx, which told it to check itself, which says to check Rss.aspx, which says to check itself, which... you get the point.

Instead, what I needed to do was rename .Text's Rss.aspx to something else, like RssFromText.aspx and instruct FeedBurner to use this alternate, “secretive” feed URL.  With this setup, a user who already subscribes to ScottOnWriting.NET through Rss.aspx will automatically be switched over to FeedBurner.  FeedBurner's RSS content will be populated from RssFromText.aspx, which will be generated from .Text, reflecting the most recent blog entries.  No more infinite loops!

To accomplish this I had to edit blog.config to tell .Text that it should use RssFromText.aspx as its RSS feed URL as opposed to Rss.aspx.  This involved updating the appropriate <HttpHandler> line like so:

<HttpHandler Pattern = "(?:\/RssFromText.aspx)$" Type = "Dottext.Framework.Syndication.RssHandler, Dottext.Framework" HandlerType = "Direct" />

With this addition, requests now to Rss.aspx are sent back an HTTP 301 status code, but FeedBurner can still slurp down the site's content through RssFromText.aspx.

Next, you'll probably want to update the link to the site's feed in the My Links section (since this will point the users to Rss.aspx, but you want them to go directly to the FeedBurner link).  (In actuality, this step is probably optional since even if you do leave it as Rss.aspx, when the attempt to view that page through a browser or slurp it through an aggregator, they'll get the 301 status code and auto-redirect to the FeedBurner URL... but still, for completeness let's change this link.)  To accomplish this, simply edit the MyLinks.ascx file in the ~/Skins/skin_name/Controls/ directory.  With version 0.94 you'll find two HyperLink controls that .Text automatically looks for and sets their NavigateUrl properties to Rss.aspx - these controls have IDs Syndication and XMLLink.  Even if you explicitly set the NavigateUrl properties to your FeedBurner URL, .Text will overwrite it and the link will be rendered as Rss.aspx.  If you try to simply remove these HyperLink controls you'll find that (at least with 0.94) .Text will barf.  What I did was simply set their Visible property to False.  I then added two HyperLink Web controls of my own that referenced the new feed URL.

There's one more facet that should be changed, although I've not made the change since (to my understanding) you'd need to actually hack the .Text source code, recompile, and re-deploy.  In the portion of the web pages in your blog you'll find a tag that's used for RSS feed auto-discovery:

<link rel="alternate" href="http://scottonwriting.net/sowblog/rss.aspx" type="application/rss+xml" title="RSS" >

Ideally the href attribute would contain the URL of your new feed... but I didn't feel like going through the headache of pecking through the source, making a change, testing, and so forth.  So I just left it as-is, figuring in the worst case someone will “discover” my feed to be Rss.aspx, which will automatically be updated to the FeedBurner syndication URL as soon as their aggregator makes its first request to Rss.aspx.

The FeedBurner service looks pretty cool upon first glance.  Once this new feed URL gets some use and I get some metrics in FeedBurner's database, I plan on sharing some of the stats... it'll be interesting to see what the most popular aggregator out there is for those who are ASP.NET developers (the primary audience of this blog, I imagine), among other data points.

posted on Sunday, August 28, 2005 5:23 PM

Feedback

# re: FeedBurner and Changing a Blog's Feed URL 8/29/2005 7:31 AM stephen patten

newgator prompted me for the new location and that was about it..besides downloading a few of your previous posts...

# re: FeedBurner and Changing a Blog's Feed URL 8/29/2005 10:24 AM Rob Walling

Thanks for the information, Scott. I recently switched my blog (www.softwarebyrob.com using Community Server) to FeedBurner and have this "301" fix on my to do list. You've saved me several hours of research.

SharpReader auto-updated the URL and re-downloaded the past 10 or 15 posts. I wouldn't have noticed had you not mentioned it.

# re: FeedBurner and Changing a Blog's Feed URL 8/31/2005 1:12 AM icelava

Omea Reader simply updated itself _without_ informing me :-)

Thanks, I should do the same thing as well. Except, I am not using .Text ;-)

# re: FeedBurner and Changing a Blog's Feed URL 8/31/2005 3:01 AM icelava

Ok I've registered a feedburner and found that posts that I've written laced with relative URLs (since they all belong to my site) will get messed up since they then become relative to feeds.feedburner.com.

That means any posting will likely require hard absolute URLs if I am to use Feedburner.

Btw, attempting to rate blog entries will throw an exception.

# re: FeedBurner and Changing a Blog's Feed URL 8/31/2005 8:51 AM Scott Mitchell

icelava, isn't that a problem (relative URLs) in any aggregator? I could have sworn that if I used relative URLs when trying to click through to a link when viewing the item through, say, RssBadit, it bombed out. Or am I mistaken?

One thing I did recently realize about FeedBurner is that it isn't possible to create a 301 HTTP on your FeedBurner feed (at least I don't see any option through the website). That means that if, down the road, you decide to stop using FeedBurner (or, heaven forbid, they go out of business), you're facing a harder time in getting your subscribers to switch over to your new RSS feed URL.

# re: FeedBurner and Changing a Blog's Feed URL 8/31/2005 10:46 AM Curtis Swartzentruber

Anybody know if there are alternatives to Feedburner that will do stats specifically for rss feeds? Seems like a common need. Figuring out unique subscribers and that sort of thing is a bit different from page views, so normal stats software doesn't really work great.

# re: FeedBurner and Changing a Blog's Feed URL 8/31/2005 10:49 AM Rob Walling

A note about getting this to work in Community Server 1.1:

Since there isn't a blog.config in CS 1.1, I added the following line to my web.config instead of adding the new HttpHandler.

<add verb="GET" path="/RealRssFeed.aspx" type="CommunityServer.Blogs.Components.WeblogRssHandler, CommunityServer.Blogs" />

I also repeated the entire process for the Atom feed, substituting atom.aspx where applicable.

Thanks again, Scott!

# re: FeedBurner and Changing a Blog's Feed URL 9/1/2005 4:22 AM icelava

Hey Scott,
i use Omea Reader and have no such problem. I guess it's smart enough to remember which FQDN host it obtained an RSS feed, and can steadily reform relative URLs correctly.

# FeedBurner Summary 9/15/2005 12:34 PM Scott on Writing

# Syndicating ComputerZen 9/18/2005 9:06 PM ComputerZen.com - Scott Hanselman

# re: FeedBurner and Changing a Blog's Feed URL 1/10/2006 7:54 AM Rob Walling

Scott, have you had any issues with RSS Readers that don't follow the 301?

I'm using Community Server, and made these changes several months ago and although most of my RSS traffic goes through FeedBurner, I still get several thousand hits a week to my old RSS and Atom feed. So some readers are either ignoring the 301 completely or they are hitting it and following it every time.

I think one of the culprits is Bloglines, as I added my feed, refreshed it, and when I checked the URL it was still the old one. I emailed Bloglines support asking if this is a known issue, but I don't really expect to hear back.

I'm wondering if you're experiencing the same thing.

Title:  
Name:  
Url:
Protected by Clearscreen.SharpHIPEnter the code you see:
Comments   

Add To Your Reader

My Links

Archives

Post Categories

 

I am a Microsoft MVP for ASP.NET.
I am an ASPInsider.
<May 2008>
SMTWTFS
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567

Comment Stats

DayTotal% of Total
Sunday 1866.8%
Monday 37913.9%
Tuesday 45316.7%
Wednesday 50418.5%
Thursday 53519.7%
Friday 49418.2%
Saturday 1666.1%
Total 2717100.0%

Hour1Total% of Total
12:00 AM 652.4%
1:00 AM 682.5%
2:00 AM 622.3%
3:00 AM 742.7%
4:00 AM 572.1%
5:00 AM 1033.8%
6:00 AM 1084.0%
7:00 AM 1585.8%
8:00 AM 1716.3%
9:00 AM 1475.4%
10:00 AM 1716.3%
11:00 AM 1816.7%
12:00 PM 1886.9%
1:00 PM 1696.2%
2:00 PM 1605.9%
3:00 PM 1324.9%
4:00 PM 1073.9%
5:00 PM 923.4%
6:00 PM 913.3%
7:00 PM 963.5%
8:00 PM 833.1%
9:00 PM 782.9%
10:00 PM 792.9%
11:00 PM 772.8%
Total 2717100.0%

Comments by Blog Entry Date/Time

Day Entry MadeAvg.Total
Sunday 5.54144
Monday 5.22339
Tuesday 4.28419
Wednesday 7.67637
Thursday 6.90607
Friday 5.48411
Saturday 5.33160
Total 5.842717

Hour1 Entry MadeAvg.Total
12:00 AM 5.0035
1:00 AM 1.002
5:00 AM 0.000
7:00 AM 7.0035
8:00 AM 5.35107
9:00 AM 6.32278
10:00 AM 6.47246
11:00 AM 4.41181
12:00 PM 6.88330
1:00 PM 3.00111
2:00 PM 5.41222
3:00 PM 8.64285
4:00 PM 4.0589
5:00 PM 5.92154
6:00 PM 4.52113
7:00 PM 9.67174
8:00 PM 9.80147
9:00 PM 5.05111
10:00 PM 5.4265
11:00 PM 4.5732
Total 5.842717

Learn More About Comment Stats
1 - All times GMT -8...


Blog Stats

Favorite Web Sites

My Books

My MSDN Articles