Bug in category feed url?

Jan 31, 2009 at 7:12 PM
Edited Jan 31, 2009 at 7:15 PM
Hi, I'm not sure if this is a bug or the result of me changing something way back when. I noticed that my category feeds in my archives page were pointing to dead links. The category feed links are also handled like this in the categorylist control. I just went to check the latest version and that's how they have it. Does the url format below work for anyone? Thanks

** Just noticed that the file extension is also hard-coded

Example of feed url generated
www.domain.com/category/feed/somecategory.aspx  


Method in archive.cs
private static HtmlGenericControl CreateRowHeader(Guid id, string name, int count)
    {
        HtmlAnchor feed = new HtmlAnchor();
        feed.HRef = Utils.RelativeWebRoot + "category/feed/" + Utils.RemoveIllegalCharacters(name).ToLower() + ".aspx";

        if (id != Guid.Empty)
        {
            HtmlImage img = new HtmlImage();
            img.Src = Utils.RelativeWebRoot + "pics/rssbutton.gif";
            img.Alt = "RSS";
            feed.Controls.Add(img);
        }

        HtmlGenericControl h2 = new HtmlGenericControl("h2");
        h2.Attributes["id"] = Utils.RemoveIllegalCharacters(name);
        h2.Controls.Add(feed);

        Control header = new LiteralControl(name + " (" + count + ")");
        h2.Controls.Add(header);
        return h2;
    }
Coordinator
Jan 31, 2009 at 7:45 PM
In be 24719 (the latest version), the category feed is working for me.  An example feed Url on my local machine is,

http://localhost/be24719/category/feed/BlogEngineNET.aspx

Are you still using the HTML extension?  That could be the problem.  If I change my web.config to use the HTML extension instead of ASPX, then I do get a 404 error.  The correct Url in that case should have an HTML extension.

http://localhost/be24719/category/feed/BlogEngineNET.html

So, it looks like the archive.aspx.cs is incorrectly assuming the extension is ASPX.  That line of code in archive.aspx.cs should instead be:

feed.HRef = Utils.RelativeWebRoot + "category/feed/" + Utils.RemoveIllegalCharacters(name) + BlogSettings.Instance.FileExtension;

(the dot isn't necessary BTW, it's already included in BlogSettings.Instance.FileExtension)
Jan 31, 2009 at 8:01 PM
It was the extension :) Thanks Ben!
Coordinator
Jan 31, 2009 at 8:13 PM
Cool ... glad I remembered you were using that extension :-)  I created an issue in the tracker for this, btw.