Adding a new page to the website/blog

Topics: Business Logic Layer
Aug 12, 2014 at 12:23 AM
Edited Aug 12, 2014 at 12:50 AM
Okay, hopefully this is my last quesion, I'm SO close to having this done, I want to thank all those who have helped me with the BE 3.0 Project, it is VERY appreciated.

What I'm trying to do now is to add two new pages to the Blog - I have it set up like a blog on the first page, and then want to have two other pages that are part of the website and I should be able to create the page and reference it in the Site.Master Menu. The Menu works perfectly, BUT, adding a new page to the BE isn't working. Well, at least not correctly. (Sigh)

Fist, I want to use my own Contact page. I know there is one that I can (sort-of) customize, but I don't like the layout of the contact form, and I want to add a very small section of Flash above the Form. Again, I have this working perfectly on my VS 2010 test site, but when I try to copy the code over to the BE I'm getting several errors.

First, just creating a new Contact.aspx page (I'm using WebMatrix to do this for the BE) it doesn't automatically create my code-behind page. Unfortunately, I am NOT a C# programmer, I'm a VB programmer, so I honestly don't know what code needs to go in a Contact.aspx.cs file as I would in the code-behind for VB:
Partial Class Contact
    Inherits System.Web.UI.Page
End Class
So when I try to run it I get "Object reference not set to an instance of an object. " But the really weird part is that in the error message this is:
[NullReferenceException: Object reference not set to an instance of an object.]
contact.OnLoad(EventArgs e) in c:\Users\thecuddlyhoney\Desktop\BlogEngine\Versions\blogengine-\blogengine_842a6cc8d607\BlogEngine\BlogEngine.NET\contact.aspx.cs:24
System.Web.UI.Control.LoadRecursive() +54
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772
Ummm - c:\Users\thecuddlyhoney\Desktop is NOT my username or location of the BE! Any idea what the heck that means?

Edited to add - In the first line of code in the C# .aspx files, I don't see where it is referring to a MasterPage (i.e., Site.Master) so I'm not sure how to reference the Site.Master page for this either. Normally you would have:
<%@ Page Title="" Language="C#" MasterPageFile="~/DJFinite.master" AutoEventWireup="true" CodeFile="NewContact.aspx.cs" Inherits="NewContact" %>
But there is nothing like that in the BE pages so I'm not sure how to reference the Site.Master page?
Aug 12, 2014 at 10:16 PM
The other page I'm trying to add is a photo album page. I am not sure how to get it to use the Masterpage from the theme. Any help on inserting the link for the masterpage would be appreciated. Ordinarily, in VB I would add the above line of code, but that is evidently not how this theme is referring to the masterpage. Can anyone please give me a hint? it would be greatly appreciated, since adding these two pages is the last thing I need to do. TIA. :-)
Aug 15, 2014 at 5:17 PM
Hi everyone, I'm really sorry to be a pest, but truthfully, this is the very last thing I have to do to get this website finished. Can anyone tell me how to include the Site.Master as my master page in my new page? I'd really appreciate a little help. Thanks!
Aug 15, 2014 at 8:06 PM
Marked as answer by Coleenh on 8/15/2014 at 3:00 PM
Aug 15, 2014 at 10:45 PM
Thank you very much, I appreciate the link. It works - sort-of. I'm using straight HTML and CSS to create the photo album, but once again, the images are not displaying, even when I use the "Cheat" method and copied the exact path to the photo directory. I had to remove the script:
<script language="c#" runat="server">
  protected static string world;
  protected void Page_Load(object sender, EventArgs e)
      world = "world!";
<asp:content id="Content1" contentplaceholderid="cphBody" runat="Server">
    Hello <%=world %>
Because it gave me an error (again, I am not a C# programmer and honestly have no idea how to write the code I need to display the photos in C# but the code in HTML is simple and straight-forward and should work:
<asp:content id="Content1" contentplaceholderid="cphBody" runat="Server">
  <div class="gallerycontainer">
<a class="thumbnail" href="#thumb">
    <img src="~/Custom/Themes/Inove/Photos/DJHeadphones.png" alt="DJ Finite" width="150" height="125" />
    <span><img src="~/Custom/Themes/Inove/Photos/DJHeadphones.png" alt="DJ Finite"/><br />Headphones</span></a>
So I am not sure how to do this. But thank you VERY much for the link at least that gave me the structure for the master page to use in the file. Now all I have to do is figure out why the photos won't display!
Aug 15, 2014 at 11:00 PM
Eureka! I found the problem - it's the ~ in the path. I removed it and now it works perfectly - thank you so very much for pointing me to that post, it is greatly appreciated!
Aug 15, 2014 at 11:04 PM
It should work by copy/paste in any .aspx page, not sure why would it give you an error.
As for images not display, you missing runat="server", so "~" can't be resolved. Should be:
<img src="~/Custom/Themes/Inove/Photos/DJHeadphones.png" alt="DJ Finite" width="150" height="125" runat="server" />
Aug 15, 2014 at 11:16 PM
The error had to do with the Script, but once I removed it and just stuck with the HTML (and removed the tilde~) it works perfectly! :-) Thanks again!