一区二区三区日韩精品-日韩经典一区二区三区-五月激情综合丁香婷婷-欧美精品中文字幕专区

分享

Scott on Writing

 昵稱1519 2005-09-11

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./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./ScottOnWriting");
}
</script>

(Of course replace the http://feeds./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:///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

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多

    少妇肥臀一区二区三区| 亚洲淫片一区二区三区| 夫妻性生活一级黄色录像| 亚洲国产精品久久琪琪| 亚洲综合伊人五月天中文| 国产成人一区二区三区久久| 狠狠干狠狠操在线播放| 国产精品刮毛视频不卡| 91欧美一区二区三区成人| 99久久精品久久免费| 人妻人妻人人妻人人澡| 欧美日韩亚洲巨色人妻| 91麻豆视频国产一区二区| 福利视频一区二区在线| 日本午夜一本久久久综合 | 出差被公高潮久久中文字幕| 日本免费一区二区三女| 青草草在线视频免费视频| 草草视频精品在线观看| 亚洲中文字幕亲近伦片| 欧美日韩国产的另类视频| 国产级别精品一区二区视频| 国产欧美一区二区另类精品 | 亚洲欧美视频欧美视频| 日韩人妻欧美一区二区久久| 国产欧美日韩精品自拍| 冬爱琴音一区二区中文字幕| 日韩欧美中文字幕人妻| 中文字幕亚洲在线一区| 国产一级内射麻豆91| 亚洲欧美日韩中文字幕二欧美| 99精品国产一区二区青青 | 欧美大黄片在线免费观看| 人体偷拍一区二区三区| 久久一区内射污污内射亚洲| 少妇被粗大进猛进出处故事| 五月婷婷综合缴情六月| 欧美尤物在线视频91| 中文字字幕在线中文乱码二区| 精产国品一二三区麻豆| 中文字幕亚洲精品人妻|