May 26, 2013

Code blocks are not allowed in this file.

In Moss 2007 or SharePoint 2010, most of the times we need to create the custom master pages. In order to perform certain actions/functions, we need to insert code within those master pages.

Main problem comes into arena, when we try to use upload that master page into the master page gallery or copying into the file system, and use as system master page or site master page. Since the custom master page contains code with in it, so we used to get the below screen.

In order to solve this problem, we need to make entries into the corresponding web.config file by following the below steps.

1) Go to corresponding web.config file location which is located at the below location ( under c drive)


2) Open the web.config file , and under the <SafeMode><PageParserPaths> tag make the below entries.

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


VirtualPath attribute should contains location where the master page is located. "/*" at the end of the /_catalogs/masterpage" in the virtual path attribute indicates to also include the subfolders.

2 comments:

  1. this approach doesn't work in sharepoint 2013.. do you know why...

    ReplyDelete
  2. Hi,
    what you are trying are to do in SP2013?

    ReplyDelete

Error installing .Net Framework 3.5 in Sql Server 2012

During installation of Sql Server 2012 on Windows server 2012 or addition of roles and features for SharePoint 2013, the setup wizard will...