The other day I posted a plea for subscribers of my blog to point the subscription for my feed to my feedburner link but today I'm asking that you change it back to the original Url of:
http://MarkItUp.com/Rss.ashx
The reason for this is that in a comment to that post, Rick Klau who is the VP of Business Development with Feedburner mentioned that I'd be better off having people continue to point at my Rss.ashx page and performing a silent re-direct to the Feedburner URL under the covers. This makes a lot of sense because it means that I'm not constantly asking people to change their link - like I am now :-)
To implement the solution I created a special URL which still exposes my RSS feed and I point the Feedburner bot at that link. The link for the bot is: http://MarkItUp.com/RssForBots.ashx. Notice that if you browse to my http://MarkItUp.com/Rss.ashx page that you will end up at the Feedburner page but it you point at the http://MarkItUp.com/RssForBots.ashx URL you will see my raw feed.
Anyways, as with all simple programming tasks things quickly went south and it resulted in a major operation. My initial thought was that I could simply use the UrlMappings service that comes with ASP.NET and re-target my RSS feed like so:
<urlMappings>
<add url="~/Rss.ashx" mappedUrl="http://feeds.Feedburner.com/MarkItUp" />
</urlMappings>
Unfortunately it turns out that the UrlMappings service will not serve up URL's that are external to your site. Damn! I'm starting to hate that darned UrlMappings thing… me and it just don't hit it off.
So what I decided to do was to create my own UrlMappings service instead. I iplemented my service as an HttpHandler that would read in a Mappings.xml file and handle re-directions to external URL's.
First I created a mappings file named UrlMappings.xml which lives in ~/App_Data and which looks like this:
<UrlMappings>
<UrlMapping url="~/Rss.ashx" mappedUrl="http://feeds.feedburner.com/MarkItUp"></UrlMapping>
</UrlMappings>
Next, because my feed is now served up at two locations I deleted the Rss.ashx physical file and moved it into the ~/App_Code directory and configured a couple of UrlMappings using that silly ASP.NET UrlMapping service like so:
<urlMappings>
<add url="~/Rss.ashx" mappedUrl="Redirector.ashx" />
</urlMappings>
In this case, Redirector.ashx is the location of the custom HttpHandler that I wrote to manage my own UrlMappings file. You can see that from the HttpHandler mappings that I created to handle the requests:
<httpHandlers>
<add verb="GET,POST" path="Rss.ashx" type="MarkItUp.SingleUserBlog.Web.RssFeedHandler" />
<add verb="GET,POST" path="RssForBots.ashx" type="MarkItUp.SingleUserBlog.Web.RssFeedHandler" />
<add verb="GET,POST" path="Redirector.ashx" type="MarkItUp.SingleUserBlog.Web.Redirector" />
</httpHandlers>
So now when a user browses to my Rss.ashx page they are redirected to the Redirector which reads my UrlMappings file and sends the request off to Feedburner. Of course the upside of all this is that SUB now has a dinky little redirector that can map out to external links - whoop-dee-doo!