Code blocks are not allowed in custom master page in SharePoint 2013

master-pagessharepointsharepoint-2010sharepoint-2013

I had migrated a SharePoint 2010 web application to SharePoint 2013 and running in compatible mode.
i have a SharePoint designer modified master-page which is saved in content database. i had some inline codes running in master-page.
the master page was working fine in SharePoint 2010.
i had this line added in page parser

      <PageParserPath VirtualPath="/_catalogs/masterpage/*" CompilationMode="Always" AllowServerSideScript="true" IncludeSubFolders="true" />

but in 2013 I still have the same line but it still gives me this error

An error occurred during the processing of /_catalogs/masterpage/custom.master. Code blocks are not allowed in this file.

when i change the entry in page parser to this it works fine

       <PageParserPath VirtualPath="/*" CompilationMode="Always" AllowServerSideScript="true" IncludeSubFolders="true" />

which is not a good way as it opens all my pages to allow scripting.

any idea what is the change in 2013 and what is the best way to achieve this in 2013

Best Answer

here's my code:

<PageParserPath VirtualPath="~/_catalogs/masterpage/*" CompilationMode="Always" AllowServerSideScript="true" IncludeSubFolders="true" />

And it works fine on my end.

Related Topic