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

17,675

Solution 1

here's my code:

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

And it works fine on my end.

Solution 2

i got it to work in 2013 by setting the virtualpath to "~/_catalogs/masterpage/*"

Share:
17,675
user2664298
Author by

user2664298

Updated on June 04, 2022

Comments

  • user2664298
    user2664298 almost 2 years

    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

  • user3078294
    user3078294 over 10 years
    make sure you use the asterisk - * at the end of the path