Yesterday a misleading error happened. A custom layout was deployed using Features and WSP solution packages. Everything went well, but when browsing to a page using this new layout, this message appeared:
Only Content controls are allowed directly in a content page that contains Content controls.
Furthermore, SharePoint inserted this funny-looking content after our Content element:
1 <!--[if gte mso 9]><xml><br /><mso:CustomDocumentProperties><br /><mso:ContentType msdt:dt="string">Page Layout</mso:ContentType>
I started googling and I found a blog post by Rich Finn that in essence has the same problem.
Apparently, when a unknown or misspelled tag is found in page layout, SharePoint adds the content type information in a XML fragment, between the <asp:Content> tags. However, in ASP.NET no additional tags are allowed as first-level children, beside Content. In our case we had one <asp:content> tag, which was misspelled.
Ensure that the <asp:Content> tags are properly capitalized. SharePoint seems to freak out when <asp:content> tag is found. 😉