How to add custom page to a blog

To add custom page to a blog, create a page in the blog root, for example "MyPage.aspx". For "MasterPageFile", use master page of your custom theme. Here used "Standard" theme.

<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Custom/Themes/Standard/site.master" %>
<%@ Import Namespace="BlogEngine.Core" %>
<script language="c#" runat="server">
  protected static string world;
  protected void Page_Load(object sender, EventArgs e)
    {
      world = "world!";
    }
</script>
<asp:content id="Content1" contentplaceholderid="cphBody" runat="Server">
  <div>
    Hello <%=world %>
  </div>
</asp:content>

Now when you navigate to MyPage.aspx, you should see content with master page applied. You can use server script for usual back-end processing, adding methods and using variable as in code behind class.


Comments are closed