0 Comments

Earlier today, Al Nyveldt aired a webcast on how to make BlogEngine.NET themes. It really shows how you can leverage all the power of ASP.NET in your themes. He uses code-behind files to dynamically change the output of the posts using nothing but C#. He walks you through building an entirely new theme and he also made it available for download.

His approach with building a theme from scratch is impressive, but I must admit that I’m too lazy for that. I would probably copy an existing theme and just modify it. It would probably not be as good as his though.

0 Comments

I’m a big fan of the System.IO.FileInfo object in .NET because it wraps the System.IO.File object nicely in a strongly typed way. It makes it easier to work with files. The FileInfo class has a method called OpenText that returns a StreamReader instance which can then be read into a string and other things.

If you use the OpenText method read the text of a file, then the easiest way is like so:

FileInfo fi = new FileInfo("C:\\currency.xml");
string content = fi.OpenText().ReadToEnd();

Now the content variable contains the text content of the currency.xml file, but there is a problem with this approach. Because the OpenText method creates a StreamReader instance which we then call the ReadToEnd method on, the StreamReader keeps a lock on the file. The can cause many problems and must be avoided.

Instead you could do like so, which releases the file handle when the StreamReader is disposed:

FileInfo fi = new FileInfo("C:\\currency.xml");
StreamReader reader = fi.OpenText();
string content = reader.ReadToEnd();
reader.Dispose();

This works fine, but we doubled the lines needed to read the text. This might not be an issue, but then we could just as well just use the StreamReader directly without using the FileInfo class like so:

using (StreamReader reader = new StreamReader("C:\\currency.xml"))
{
  string content = reader.ReadToEnd(); 
}

It is much cleaner than using the FileInfo class and the intent is very clear as well.

10 Comments

Today, I am proud to announce the next version of BlogEngine.NET is being released to the public. A lot of new features and improvements have been added along with new cool themes.

The BlogEngine.NET team and I are very pleased with this release, because it marks the continuous evolution of the project. Both the community and the team have been very innovative and have created a solid solution together. The community has done so much work on the project since the first release and it is only because of that we can release this soon. Truly amazing.

The performance is much better, the whole application is more stable and secure, and a lot of features have been added. A lot of small things have also been added or improved such as all the themes are 100% XHTML compliant and supports various microformats out of the box.

You can read the release note on the BlogEngine.NET website and you can download the new release from CodePlex right now.

0 Comments

There are different approaches to localizing an ASP.NET application. You can use a global resource file or local ones. The local resource files only applies to a single page or user control, whereas the global can be used from anywhere.

I’ve always used the global resource file located in the App_GlobalResources folder. I like that I can use all the text strings wherever I want. However, I have never used a local resource file for a specific page or user control for that very same reason.

Lately though, I’ve thought that the local resource file might be good for some specific scenarios. For instance if I know that a particular string is only going to be used on one specific page, then I don’t clutter the global resource file with page specific strings. However, then the information is spread over multiple files instead of just the global ones.

It reminds me about HTML style attributes and stylesheets. Is it ok to hardcode styles directly onto a page if the same style is not being implemented anywhere else? In my opinion yes, sometimes it makes sense, but I’m generally against it just like I’ve been against using local resource files.

Do you use local resources and if so, why have you chosen that instead of a global file?

0 Comments

You have probably read all there is to know about getting people to link to your blog before, and this post doesn’t tell you anything you don’t already know. This is merely a nice trick to get many people to link to you, without having to do much work.

Basically, the more people who links to you, the higher your blog ranks in search engines. There are many details to this, but that’s a totally different story written by much smarter people than me.

The trick

This has worked extremely well for me for a long time and it is very easy to pull off. It works no matter what blog platform you use.

You probably have designed your own theme or modified an existing one for your blog. It probably looks really nice too. That’s exactly what Tom Watts thought about my old theme for dasBlog and therefore asked me if it was ok that he included it into the next release of dasBlog. Of course it was. At that point I had already made the theme available for download for anyone interested and a lot of people actually did (I can’t imagine why).

The trick is that I added a piece of text to the bottom of the theme which linked back to my own blog. It looked something like this:

dasBlog theme byMads Kristensen

That sweet traffic

Almost from one day to another, people started to use my theme and links started coming in. After a couple of months when the search engines had done their indexing, my blog got much better ranking because of all the links.

Now I receive a lot of search engine traffic as well as general link traffic and I can thank the theme for a big part of it. So, now you might wonder how to get your theme included in your blog platform of choice.

Get your theme out there

Many of the smaller and mid-sized blog platforms such as dasBlog, Subtext and BlogEngine.NET are probably more than willing to include a nice theme because they might not have that many and they all want to offer as much out of the box as possible. Just write to them and ask if they are interested in including your theme.

For the big platforms such as WordPress and MovableType you probably can’t get your theme bundled. Instead you can add your theme to the various theme sites where people can download themes and also have the download available on your own blog.

It is very easy to get your theme out there with a little effort and the results are noticeable.

For BlogEngine.NET users

After the next release scheduled for this Monday, we are going to release a theme pack with all the themes that didn’t make it into the final release. If you have written a nice theme then we can include it into that pack and into future versions as well. Just remember to add a discrete link to your own blog somewhere.