Sourcecode for the blog importer application?

Nov 29, 2009 at 10:02 AM

I am trying to migrate from dasBlog to BlogEngine. To retain all external references to my blog I am figuring out how to keep the Guids used in dasBlog for the permalinks and then I want to do a Url rewrite in BlogEngine.

The problem is that in the BlogImporter.asmx, new Guids are generated. Better would be to re-use the Guids from dasBlog but to do this I have to change the blog importer application but I can't find the source code?

Here is what I mean. In my old blog I had for example this permalink:,guid,41672950-00a9-42a9-8bf5-02cc58cc48a6.aspx

In BlogEngine the same link is now:

As you can see, completely new Guids which to be honest, I have no idea why the importer is implemented like this. If the importer retains the old Guids, then it is a 5 minute job to use a Url rewriter to fix this. I cannot imagine that I am the only one that wants this.

Nov 29, 2009 at 10:15 AM

In the BlogImporter.asmx file, you can explicitly set a PostId after the new Post is created.

Post post = new Post();
post.Id = YOUR_ID;

But the data passed into AddPost() is an ImportPost object that doesn't contain a Post ID (from your old blog).  You should be able to make an adjustment for that by modifying the Blog ML app.  It's open source and can be downloaded at:

Nov 29, 2009 at 10:28 AM

Thank you that is what I was looking for. I idd figured that out about the AddPost and the ImportPost. Furthermore the Id property of Post is read-only therefore I added a 2nd constructor to pass a Guid. I will take a look at BlogML and change it accordingly for my needs.

Thank you very much :-)

Nov 29, 2009 at 10:33 AM

I think I was a bit to fast with my reply. I took a look at the BlogML project but basically this is not really what I am looking for. The exported BlogML file already contains the old ID. The problem is in the Import used by BlogEngine.NET. This importer just ignores the IDs. I want to modify the importer so that it sets the Id of the ImportPost correctly. Where can I find the source code for the importer from BlogEngine?

I don't have the intention of completely writing my own import just because I want to pass the ID. 

Nov 29, 2009 at 11:04 AM

I don't think Post.Id is read-only.  At least in VS, in BlogImporter.asmx, when I add

post.Id = Guid.NewGuid();

There's no complaint by the compiler and the DbBlogProvider also updates the post ID when it reads data from the DB:

post.Id = rdr.GetGuid(0);

But either way, it sounds like you're already set for this part with the 2nd constructor.

To be honest, I'm not sure where that source code for the BlogML importer is.  I'll ask around and see if it's available.

Although it may not be worth your time, one option would be to put the exported BlogML file in your BE folder, and when the AddPost web service gets called, you could open up the BlogML file from within AddPost and search for the post by Title.  When you find the entry, you should be able to get the original Post ID.  With this approach, you don't need to worry about passing the original post ID into AddPost.

Nov 29, 2009 at 11:17 AM

I dowloaded the clickonce application and dissassembled it completely with a Reflector add-in. I am going to modify the importer and then retry it.

Nov 29, 2009 at 11:33 AM

Ah, great idea.  In the meantime, I put in a question to see about the source code for it.  Even if you get things going with your latest approach, it'll be good to have the source available for the "next time" !

Nov 29, 2009 at 10:35 PM

Here's the blog importer code:

Nov 30, 2009 at 6:29 AM

Thx for the link, i will give it a try.

Jan 8, 2010 at 9:45 AM
BenAmada wrote:

Here's the blog importer code:


Do you have a version corresponding to the delivery version of BlogEngine.NET ?

I seem the current uploaded is not the lastest one, can you confirm this ?