1
votes

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

3
Have you tried to specify exact name of master page?<PageParserPath VirtualPath="/_catalogs/masterpage/MyMaster.master" CompilationMode="Always" AllowServerSideScript="true" />Yevgeniy.Chernobrivets

3 Answers

2
votes

here's my code:

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

And it works fine on my end.

0
votes

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

0
votes

Did you modify the master page in SharePoint 2010, or only in 2013?

This page: http://blog.bullseyeconsulting.com/archive/2013/03/21/fixing-code-blocks-not-allowed.aspx

Quoting:

As soon as it is "customized" (formerly known as "unghosted"), the reference to [the master page] for that site is in the database, not the file system. Without a change to web.config, code blocks are not allowed and the page breaks.