I'm getting this error on a copy of our SharePoint 2013 site collection. I've tried unghosting searchresults.aspx, but it comes back with "Cannot revert to the site definition version of this file. It is a custom file and is not part of the site definition".

enter image description here


I am currently having the same issue with my 2013 search site. here is the article helped me.

I was still having the same error after following the article above. I have added the line below in the web.config

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

After this, the error has disapeared. This is not a very good solution because it is allowing all pages to run server side scripts.

You can use this to limit the pages VirtualPath="~/_catalogs/masterpage/*"

  • In my case I was creating a new basic search center site from scratch. When I tried Enterprise Search Center I did not have this problem :) – Aslan Jul 31 '15 at 20:52
  • This didn't work for me: VirtualPath="~/_catalogs/masterpage/*" – PeterX Oct 27 '15 at 2:48
  • In SharePoint 2016 the wildcard approach is all that worked, exactly as it is written in the solution. Make sure to include the "IncludeSubFolders" attribute – phil Sep 12 '16 at 21:48

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.

SharePoint disables the ability to create server-side script by default, you have to turn it on. You do that in the web.config file, in the configuration/SharePoint/PageParserPaths configuration section:


  <PageParserPath VirtualPath="/pages/test.aspx" CompilationMode="Always" AllowServerSideScript="true" />


Code-blocks are not allowed in this file: Using Server-Side Code with SharePoint

  • 1
    I'm still facing same issue even also i had specified above tag in web.config – Light Jul 21 '15 at 9:29
  • The VirtualPath in this example should be the path to your custom master page that is giving the error. e.g. /_catalogs/masterpage/mycustom.master – JakeJacobsen Mar 18 '16 at 15:37

If there is a blue mark before your SearchResults.aspx,right click on it and click'Reset to Site Definition'

  • 2
    This does not answer the question as per the StackExchange standards. Please check How to Answer. One-liners can be mentioned in a comment. – Yash Saraiya Feb 23 '16 at 10:22

Tried both specific and wild card both did not work for me. What make it work was to reset the page 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.