BlogEngine - an open source blogging solution
BlogEngine.NET is an open source ASP.NET project that was born out of desire for a better blogging platform. Which focused on simplicity, ease of use, extendibility and innovative design while taking advantage of the latest .NET features.
BlogEngine.NET is easily customizable. It has many downloadable themes, widgets, and extensions or you can make your own with some basic .NET skills. With BlogEngine.NET, it is easy to make your blog look and function exactly how you’d like.
Since it is open-source, source code is available free to download, deploy and customize. Just click here to download your copy today.
Make sure your system meets following criteria.
.NET 4.5.1 (which latest updated)
Visual Studio 2013 Recommended
Running in Visual Studio Guidelines
After downloading, extract the code. You will see following folder structure, you need to double click on BlogEngine.sln file.
In Visual Studio it will look like following:
Now right click on Solution ‘BlogEngine’ and build solution and then run. You will see this page loads up in the browser which is exactly given in below screenshot.
Now you have running BlogEngine website with complete source code in Visual Studio, so you are all set to start coding on this but before this let’s understand what database BlogEngine uses to store information’s.
SQL Server Database Provider
By default BlogEngine uses XML to store information which we can easily migrate to SQL Server, MySQL or any other database provider.
In the Visual Studio you need to make following changes in Web.Config file. In the blow screenshot you can see I’ve replaced XmlBlogProvider by DbBlogProvider. Again build the solution and run it.
Another change you need to make in the same Web.comfig file is given below. Just use your SQL Server database username, password and database name. You don’t need to create database in SQL Server yourself. On the first run it will create one for you automatically if your provided credentials are valid.
Or, if you want to create database yourself this is also possible here, just expand setup folder you will see all script files and sample Web.config to use. I highlighted the script file and Web.config your should use.
Adding Custom Page
Keep in mind, BlogEngine uses its own CMS so all pages you see are actually stored in database. In this case adding new page by right clicking on project and running it will not work. Also, you will not see any Master Page in file explorer. So, how head footer nativation will appear on custom added pages?
Well, for this all custom aspx pages need to implement from BlogBasePage class. Here is one example, I added a test.aspx page (web form with no master page). And made following changes:-
On Test.aspx page:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="BlogEngine.NET.test" ValidateRequest="false" %>
<%@ Import Namespace="BlogEngine.Core" %>
<asp:content id="Content1" contentplaceholderid="cphBody" runat="Server">
Here is body of the page
On Test.aspx.cs page:
public partial class test : BlogBasePage
protected void Page_Load(object sender, EventArgs e)
Now run the website and try to navigate on http://localhost:port/test.aspx page you will see this page working. Now you can place your controls on test.aspx form and write your C# codes in code-behind and compile and run. Great.
Now you have working source code, database in SQL Server and idea to add custom pages. Here you are requested to create following feature on BlogEngine website.