Wednesday, 16 November 2011

master page error : Code blocks are not allowed in this file.

The reason of the above error very probably the customized state of your Master Page. You see, each Master Page you create using SharePoint Designer is customized - its source is stored in the content database of SharePoint. The same behavior occurs when you modify a Master Page or a Page Layout using SPD. For security reasons customized pages are not allowed to use in-line code. The same errors is being caused by the control responsible for generating Variations menu: as soon as you remove it from your Master Page and ensure there are further no other code blocks, your Master Page should work fine. Another solution is to provision the Master Page using a Feature so that it remains uncustomized.

try to remove the ~ from the MasterPageFile="~/MasterPage.master" tag inside the content page and if it still does not work, remove the / if the are "mater page and the content page" in the same root.

Another way
You just have to edit your web.config file :

<Safemode …>
<PageParserPath VirtualPath=”/_catalogs/masterpage/publishing.master” CompilationMode=”Always” AllowServerSideScript=”True” />

No comments:

Post a Comment