Note that there are some explanatory texts on larger screens.

plurals
  1. POMaster Page Weirdness - "Content controls have to be top-level controls in a content page or a nested master page that references a master page."
    text
    copied!<p>This is weird. I added a brand new Web Application project to my solution in Visual Studio 2008. </p> <p>Created a master page. Made zero modifications. Created a new webform. Set its master page to the MP I just created. </p> <p>Still, no modifications. No markup. No user controls. No references. Nothing. However when I try to run it, I get:</p> <pre><code>Content controls have to be top-level controls in a content page or a nested master page that references a master page. HttpException (0x80004005): Content controls have to be top-level controls in a content page or a nested master page that references a master page.] System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection) +8665016 System.Web.UI.Page.get_Master() +51 System.Web.UI.Page.ApplyMasterPage() +15 System.Web.UI.Page.PerformPreInit() +45 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +282 </code></pre> <p>If I do the same exact thing in a standalone project thats outside of this solution, it works fine. Keep in mind that I'm using a web application project vs a website project if that makes any difference.</p> <p>The webform:</p> <pre><code>&lt;%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="WebUI._Default" MasterPageFile="~/Site1.Master" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" &gt; &lt;head runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>The master page:</p> <pre><code>&lt;%@ Master Language="VB" AutoEventWireup="false" CodeBehind="Site1.master.vb" Inherits="WebUI.Site1" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" &gt; &lt;head runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;asp:ContentPlaceHolder ID="head" runat="server"&gt; &lt;/asp:ContentPlaceHolder&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"&gt; &lt;/asp:ContentPlaceHolder&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload