{"id":265,"date":"2012-02-03T22:16:51","date_gmt":"2012-02-04T03:16:51","guid":{"rendered":"http:\/\/www.compdigitec.com\/labs\/?p=265"},"modified":"2012-02-03T22:16:51","modified_gmt":"2012-02-04T03:16:51","slug":"solving-only-content-controls-are-allowed-directly-in-a-content-page-that-contains-content-controls","status":"publish","type":"post","link":"http:\/\/www.compdigitec.com\/labs\/2012\/02\/03\/solving-only-content-controls-are-allowed-directly-in-a-content-page-that-contains-content-controls\/","title":{"rendered":"Solving &#8220;Only Content controls are allowed directly in a content page that contains Content controls&#8221;"},"content":{"rendered":"<p>While debugging and creating a new ASP.NET User Control, I stumbled across the following error, &#8220;<em>Only Content controls are allowed directly in a content page that contains Content controls<\/em>&#8221; that I did not encounter before. The culprit: an invalid assembly in the custom ASP.NET User Control registration section of &#8220;<em>web.config<\/em>&#8220;:<\/p>\n<p>The first thing I tried, is, of course, to <a href=\"http:\/\/social.msdn.microsoft.com\/forums\/en-US\/sharepointdevelopment\/thread\/de64e551-1441-4e1d-9956-277b352cd9b1\">follow<\/a> <a href=\"http:\/\/www.codeproject.com\/Questions\/184240\/Error-Only-content-controls-are-allowed-directly-i\">the<\/a> <a href=\"http:\/\/www.fewlines4biju.com\/2011\/11\/only-content-controls-are-allowed.html\">advice<\/a> <a href=\"http:\/\/edinkapic.blogspot.com\/2008\/10\/only-content-controls-are-allowed.html\">on<\/a> <a href=\"http:\/\/stackoverflow.com\/questions\/679246\/do-script-tags-and-link-tags-go-inside-aspcontent-or-outside\">the<\/a> <a href=\"http:\/\/forums.asp.net\/t\/1579320.aspx\/1\">can<\/a> and remove any tag or text other than &#8220;&lt;asp:Content&gt;&#8221; tags from the page. But as, you can see, there are no other characters or tags on the page, and I had tried many times to regenerate the page or force VS to &#8220;re-parse&#8221; the page without success.<\/p>\n<p><a href=\"http:\/\/www.compdigitec.com\/labs\/wp-content\/uploads\/2012\/02\/contenterror1.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-266\" title=\"Only Content controls are allowed directly in a content page that contains Content controls\" src=\"http:\/\/www.compdigitec.com\/labs\/wp-content\/uploads\/2012\/02\/contenterror1.png\" alt=\"\" width=\"653\" height=\"388\" \/><\/a><\/p>\n<p>After some more debugging for a while, I found this error, which was related to an invalid assembly in the registering custom ASP.NET User Controls section of the web.config document:<\/p>\n<div id=\"attachment_267\" style=\"width: 830px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/www.compdigitec.com\/labs\/wp-content\/uploads\/2012\/02\/contenterror2.png\"><img aria-describedby=\"caption-attachment-267\" decoding=\"async\" loading=\"lazy\" class=\" wp-image-267 \" title=\"Found another error\" src=\"http:\/\/www.compdigitec.com\/labs\/wp-content\/uploads\/2012\/02\/contenterror2.png\" alt=\"Found another error\" width=\"820\" height=\"388\" \/><\/a><p id=\"caption-attachment-267\" class=\"wp-caption-text\">Found another error<\/p><\/div>\n<p>And the answer? It turns out it was easy enough to fix after all, just fix the offending assembly reference!<\/p>\n<div id=\"attachment_268\" style=\"width: 566px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/www.compdigitec.com\/labs\/wp-content\/uploads\/2012\/02\/contenterror3.png\"><img aria-describedby=\"caption-attachment-268\" decoding=\"async\" loading=\"lazy\" class=\" wp-image-268 \" title=\"The culprit of the error, Only Content controls are allowed directly in a content page that contains Content controls\" src=\"http:\/\/www.compdigitec.com\/labs\/wp-content\/uploads\/2012\/02\/contenterror3.png\" alt=\"The culprit of the error, Only Content controls are allowed directly in a content page that contains Content controls\" width=\"556\" height=\"140\" \/><\/a><p id=\"caption-attachment-268\" class=\"wp-caption-text\">The culprit of the error, Only Content controls are allowed directly in a content page that contains Content controls<\/p><\/div>\n<p>And <em>voila<\/em>, fixed:<\/p>\n<div id=\"attachment_269\" style=\"width: 291px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/www.compdigitec.com\/labs\/wp-content\/uploads\/2012\/02\/contenterror4.png\"><img aria-describedby=\"caption-attachment-269\" decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-269\" title=\"Fixed!\" src=\"http:\/\/www.compdigitec.com\/labs\/wp-content\/uploads\/2012\/02\/contenterror4.png\" alt=\"Fixed!\" width=\"281\" height=\"399\" \/><\/a><p id=\"caption-attachment-269\" class=\"wp-caption-text\">Fixed!<\/p><\/div>","protected":false},"excerpt":{"rendered":"<p>While debugging and creating a new ASP.NET User Control, I stumbled across the following error, &#8220;Only Content controls are allowed directly in a content page that contains Content controls&#8221; that I did not encounter before. The culprit: an invalid assembly in the custom ASP.NET User Control registration section of &#8220;web.config&#8220;: The first thing I tried, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[681,289,783,784,782],"_links":{"self":[{"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/posts\/265"}],"collection":[{"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/comments?post=265"}],"version-history":[{"count":0,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/posts\/265\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/media?parent=265"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/categories?post=265"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/tags?post=265"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}