This project is read-only.

Category Issues

Topics: ASP.NET 2.0
Sep 14, 2009 at 3:25 PM


I need to edit the category of my blogengine install. I deleted a few and renamed a few. I deleted one of my edited categories and now I get an error when I load my site.

Error: Object reference not set to an instance of an object.

[NullReferenceException: Object reference not set to an instance of an object.]
   BlogEngine.Core.Category.CompleteTitle() +110
   Controls.CategoryList.SortCategories() +138
   Controls.CategoryList.BindCategories() +41
   Controls.CategoryList.get_Html() +76
   Controls.CategoryList.RenderControl(HtmlTextWriter writer) +11

If anyone can help me out, i would really appreciate it.


Nov 2, 2009 at 8:26 AM

I had the same error and was successful using following strategy:

The reason seems to be nested categories. When a parent category is deleted this instance is missing an the above error is displayed.

First replace the actual version of category.xml by an older but running version.

Then it is necessary to recompile the whole application e.g. by making a small change in global.asax (insert a space an save the document).

When the application is restarted it takes a while to compile and then it works.



Nov 3, 2009 at 3:05 AM

I'm running in a hosted environment ( The basic blog settings work fine - except the categories. When I create a new category - it seems to create it in the database - but not in the filesystem. For e.g. - I created a category called Language Features under General Software Ramblings. So - if everything worked ok - it should have created a default page for the category called - /category/General-Software-Ramblings-Language-Features-c.aspx . However - no such page is created - leading to a 404 error. Any ideas? I believe the version is 1.4




Nov 4, 2009 at 10:07 AM

This is a "known" issue that was fixed after 1.4.  Fortunately, it can be fixed.

The problem is when you use Parent Categories, the URL to the child category in the Category List widget combines the parent category name and the child category name.  The URL should only contain the child category name.

To fix this, in the App_Code\Controls folder, there's a file named CategoryList.cs.  In it, you should find this line of code:

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

The correct line SHOULD BE:

anc.HRef = Utils.RelativeWebRoot + "category/" + Utils.RemoveIllegalCharacters(cat.Title) + BlogSettings.Instance.FileExtension;

Similarly, for the little RSS feed icon, you probably currently have:

feedAnchor.HRef = Utils.RelativeWebRoot + "syndication.axd?category=" + dic[key].ToString();

But this should be:

feedAnchor.HRef = Utils.RelativeWebRoot + "category/feed/" + Utils.RemoveIllegalCharacters(cat.Title) + ".aspx