Supporting Multiple Master Pages in BlogEngine.NET is quite simple. An example of a master page at dbvt.com different from my primary master page, i.e. with a different sidebar, is the Contact Page.
To get started we're going to make a couple of changes in the BE.NET source library's BlogBasePage.cs Class located in /web/controls/. First we're going to add a property to contain our master page name.
private string dbvtMasterPage = "site.master";
public string DBVTMasterPage
{
get { return dbvtMasterPage; }
set { dbvtMasterPage = value; }
}
Next we'll replace the hard-coded site.Master designation with our DBVTMasterPage property OnPreInit().
protected override void OnPreInit(EventArgs e)
{
if (Request.QueryString["theme"] != null)
_Theme = Request.QueryString["theme"];
MasterPageFile = Utils.RelativeWebRoot + "themes/" +
_Theme + "/" + this.DBVTMasterPage;
Now in the CodeBehind.cs of our Contact Page we'll add an OnPreInit() method and specify our DBVTMasterPage property.
protected override void OnPreInit(EventArgs e)
{
this.DBVTMasterPage = "contact.master";
base.OnPreInit(e);
}
The only thing left to do is create the contact.master page!