Saturday, December 22, 2007 as your blog engine!

This article is a short description of how to use as your blog engine for your personal ASP.NET web page. I.e. an example of how to have a account and write your blogs there and at the same time display your blog on another web page.

I was tired of developing my own blog/article engine so I wanted to use one of the existing ones (why reinvent the wheel?!) and then display the blog on my web page ( My first approach was to use Windows Live Spaces ( But the blog functionality was limited to one blog only, I wanted three (one for my personal blog, one for the tech-blog and one for my projects). Next I wanted an API for .NET and I wanted to use Windows Live Writer for writing blogs.


My choice of blog engine was; part wise because of the very nice .NET API (Google Data API) that Google provides but also because have great blogging functionality. After the API was downloaded and installed into a sample web project I wanted to create a web page with the following functionality:

1. A list of recent blogs.
2. A month/year-list for blog archive.
3. A page displaying the most recent blogs.
4. A page displaying a single blog-post and all its comments.
5. A structure of all the above so that a new blog could be added to a web site in a simple way.

This is the structure:

The topmost part is the Blog.aspx site. This site is the one that you can customize to fit your layout and make your blog look the way you want to. Technically the controls will call some method in the Blogger.cs file (GetRecentPosts, GetPost, GetArchive...). This class will then forward the question to via the Google Data API and retrieve the data.
To use several blogs on your web site you can create several files like Blog.aspx (e.g. Blog.aspx, Projects.aspx, Articles.aspx). In each of these files you set the path to the blog on blogspot (e.g.

This example does not require you to login or pass any login-information to get the data. In other words this is a blog viewer and you can actually view other blogs than your own, you only have to provide the address to the blog you want to display. You can also not post to your blog account, use Windows Live Writer or the online interface.

One problem that I found when developing this example was that I wanted a visitor to be able to post comments to my posts on my site. This is kind of possible but there is one problem. Via the Google Data API, only the owner of the blog can post a comment to the blog (using login information via the API) and this means that all comments from my site will be displayed like it was I that posted the comment, not very pretty. So my solution is to put a link to the blogspot comment page, so that a user can comment the post via the interface. The reason why not anyone can post to your blog is that spam bots could then use the Google API to post spam to your blog. When you post a comment via the blogspot interface you must provide a captch-string and then spam bots can be stopped.

Download Source
Download the Visual Studio example here.

Examples - - -


Anonymous said...

I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.


Engine Parts said...

Hey guys!
i just started blogging not that long ago and running across this blog it seemed a bit too interesting to only read the first paragraph. I kinda got confused in the middle of it but the end just made it all go together like a puzzle. Please, who ever wrote this, keep me updated!

moratmmarit said...

Thanks for information..keep spirit!!:)