We are getting the error below when applying a custom masterpage (based on an HTML masterpage) to a search center in a SharePoint 2016 site collection.

An error occurred during the processing of /sites/[name of site]/search/results.aspx. Code blocks are not allowed in this file.

Scope of the issue

So far the search center result page is the only page we see this on. The settings page of the search center can be used without issues. Also creating site pages on the search center can be done without issues.

Steps tried

  • We investigated suggestions that would require you to change the web.config but did not follow this course due to security risks.
  • Tried to reset the page to the site definition but could not find the button in SharePoint Designer 2013 nor the site itself.

1 Answer 1


Enabling the SharePoint Server Publishing feature in the search centers' site features fixed this issue.

An alternative solution (workaround) would be to use a new site page as a search results page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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