There is a lot of new features on almost every objects in the BlogEngine.NET code base, so here are a few examples on how to take advantage of some of them. I’ll put up some new videos soon highlighting some of these features.
User control injection with parameters
The user control injection feature introduced in version 1.2 has been upgraded, so that it now let’s you insert property values. Let’s imagine you have a user control called poll.ascx with two public properties called Name (string) and MaxAnswers (int). You can now set those properties from the editor by separating the properties with a semicolon like this:
[ usercontrol: ~/poll.ascx Name=Name of poll; MaxAnswers=200]
Some people have a lot of tags and a lot of these tags only contain 1 post. That can clutter the TagCloud, so now you have the ability to specify how many posts a tag should contain as a minimum to be shown in the TagCloud. The default is 1 post, but you can change it in your theme like so:
<blog:TagCloud MinimumPosts="2" runat="server" />
Extensions and CancelEventArgs
The System.ComponentModel.CancelEventArgs are now used for a various different events. It let’s you cancel an action like adding comments or receiving trackbacks. Here is what to do in order to take advantage of the new model:
TrackbackHandler.Received += new EventHandler<CancelEventArgs>(TrackbackHandler_Received);
// event handler
void TrackbackHandler_Received(object sender, CancelEventArgs e)
if (HttpContext.Current.Request.UserHostAddress == "123.456.78.90")
e.Cancel = true;
This is an example of how to cancel a trackback request from being processed based on the IP address of the requesting website.