After applying patches to our SharePoint 2013 farm several of our enterprise search sites now throw this error The base type 'Microsoft.Office.Server.Search.Internal.UI.SearchResultsLayoutPage' is not allowed for this page. The type Microsoft.Office.Server.Search.Internal.UI.SearchResultsLayoutPage, Microsoft.Office.Server.Search, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c could not be found or it is not registered as safe. Even when attempting to create a new search results page from the pages directory then attempting to navigate to the page the same error is thrown. These sites are publishing sites as well. The Logs have not been helpful either only stating the same error.


Either add the safecontrol to your config file or update the SearchResults.aspx page layout's top section.

<%@ Page language="C#" Inherits="Microsoft.SharePoint.Publishing.PublishingLayoutPage,Microsoft.SharePoint.Publishing,Version=,Culture=neutral,PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 
<%@ Register Tagprefix="OSRVWC" Namespace="Microsoft.Office.Server.WebControls" Assembly="Microsoft.Office.Server, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 
<%@ Register Tagprefix="OSRVUPWC" Namespace="Microsoft.Office.Server.WebControls" Assembly="Microsoft.Office.Server.UserProfiles, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 
<%@ Register Tagprefix="SPSWC" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.SharePoint.Portal, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 
<%@ Register Tagprefix="SEARCHWC" Namespace="Microsoft.Office.Server.Search.WebControls" Assembly="Microsoft.Office.Server.Search, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 
<%@ Register Tagprefix="PublishingWebControls" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

See the following link: https://social.technet.microsoft.com/Forums/office/en-US/c024ee28-35ef-473c-85a5-181bc3c68c37/parser-error-when-trying-to-use-enterprise-search?forum=sharepointsearch

  • Adding the safecontrol line to the config file resolved the issue. Any idea why that is needed after the patches? – Bill Cahill Apr 27 '15 at 12:35

I gleaned my answer from this post: http://www.sharepointassist.com/2011/10/20/sharepoint-error-code-blocks-are-not-allowed-in-this-file/

I had tinkered with the pages, but nothing that I needed to save. On my intranet site, I went to my Search Site Collection and under Site Settings I went to the Site Actions section and clicked "Reset to site definition" this fixed the issue of the "Code blocks are not allowed in this file" error.

Next I went to my Central Administration and followed the same procedure, resetting to the site definition for the Central Admin site collection.

Just know that this will wipe out any customizations. I didn't have any customizations on my SC's, so I didn't worry about it.

Hope this helps! Nick


My searchresults.aspx page located at /_catalogs/masterpage was edited. After I restored it back to site definition the error disappeared.

Just right click on the file and choose Reset to site definition

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.