Delta Engine Blog

All about multiplatform and game development

How to migrate from dasBlog to BlogEngine.NET!

dasBlog

Here are my main reasons why I switched this blog from dasBlog to BlogEngine.NET recently:

  • Too many problems with dasBlog over the years (I have been using it for 5 years now)
  • Often simple features like commenting just stop working or causing problems on different browsers
  • Checking for spam is way too hard (see below, I wrote a helper app)
  • Customizing dasBlog is hard
  • Development of dasBlog is almost frozen (not much updates anymore)

Don't get me wrong, I absolutely loved dasBlog (else I would not have been using it for 5 years), but after porting dasBlog to our new website at exDream I encountered some really annoying problems. After I copied over the content files I just got strange security errors. After I fixed those all blog posts were gone. Then after coping all files once again and restarting the app, the next error appeared: Cannot add duplicate item and so on. After one or two hours I got everything working, but while searching for solutions to my problems I encountered BlogEngine.NET. Many people seem to have switched in the last 2 years, I heared of it before but I did not see any reason to switch. Now however after checking out the simple tools, the great extensibility and the much easier to use theming, I was hooked.

Switching was not painless, but overall it was a pretty quick process. Just have to figure out how to convert WordPress (another blog) to BlogML and then import those posts into the same BlogEngine blog. The main difficulty was to export dasBlog entries to BlogML and get it back into BlogEngine.NET.

BlogEngine.NET

I used the following tool to export from dasBlog to the BlogML format: http://www.paulvanbrenk.com/blog/2006/12/27/BlogMLSupportForDasBlogBeta.aspx
After fiddeling around the the command line tool I got the exporter working. While it was annoying that it threw so many exceptions, it later helped me to figure out some settings I had to make both in the tool and on the dasBlog site.

You can alternatively also use the UI merill build for the DasBlog to BlogML Converter:
http://www.cyberslingers.com/weblog/post/Upgrading-BlogEngineNET-hosted-on-1and1-using-the-Blog-Importer.aspx

Next you gotta import BlogML back into BlogEngine.NET, but I had many spam comments and trackbacks in my old blog, which I wanted to get rid of. So I wrote a little application that parses the whole export.xml file (was around 11MB for me) and removes everything that stinks. This is the whole console application (it uses Log and StringHelper from my utilities and XLinq, not much else, it should be easily extendible to block more spam): BlogImportSpamRemover.cs (6.42 kb)

This resulted in reducing my 11MB of blog data to 2.5MB (wow) with the following spam removal statistics:
Info: Saved exportCleaned.xml! Parsed 283 posts with 477 comments and 30196 trackbacks. Found and removed 51 spam comments and 30112 spam trackbacks!

Finally importing the blog entries also caused some trouble. First the Import BlogML application inside BlogEngine.NET must be started from IE (FireFox saves the file, and then launching it won't work), then I had to try different settings until everything validated and finally the importer always aborted with "Invalid username or password", which made no sense. Luckily I quickly found the solution, just add post.DateModified to the \api\BlogImporter.asmx:
http://www.pksoftware.net/devblog/post/A-fix-for-the-Blog-Engine-Importer-tool-problem.aspx

After that all blog posts were imported and are live here now :) I later found out that using ASP.NET 4.0 causes some additional problems. First you have to use "requestValidationMode="2.0"" for the web.config system.web/httpRuntime key, else posting blog entries will just fail with a dangerous request error page. Then some extensions like the Poll will just stop working and keep telling you strange things like "Please choose an answer" even if you select a valid answer. I checked with Firebug and saw that the Ajax calls all failed. So I switched back to the ASP.NET 2.0 DefaultAppPool and things started working again.

One last issue I had after a very long day of fixing css was the fact that all my other web applications stopped working (under the root where BlogEngine is now located). I tried to remove httpModules in the other web applications and reinstalled some apps, but nothing helped. BlogEngine is really messing around by disabling sessions, rewriting all kinds of urls, demanding strange files, etc. Only after I found this extremly useful blog entry (after finding less useful posts like this one for ScrewTurn (wiki) or this one for YAF (Yet Another Forum), which both did not work) I was easily able to fix all the problems by just forcing the root web app not to inherits it stupid incompatible web.config settings to all the children web applications: http://www.jaylee.org/post/2008/03/Prevent-ASPNET-webconfig-inheritance-and-inheritInChildApplications-attribute.aspx

Well, in the end everything worked out great and now the whole website is working better than ever and much easier to customize than before. Maybe I will talk about the dynamic features of the other pages (Games and Gallery) sometime soon, which is kinda cool (they all are just generated on the fly from some directories).