Monday, 25 October 2010

Fix - "An error occurred during the processing of /_catalogs/masterpage/CompanyNameHomePage.aspx. Code blocks are not allowed in this file." - SharePoint 2007 Exception

Today I had an urgent call from the Support desk at my current client - and had to be pulled out of a meeting to help resurrect a corporate intranet. All pages in the corporate intranet were down and all were giving the same error:

"An error occurred during the processing of /_catalogs/masterpage/CompanyNameHomePage.aspx. Code blocks are not allowed in this file."


Turns out one of the support guys had checked out a page when viewing the master page library and checked it back in. There were no actual changes to the page code at all - but to try and fix the problem, they tried to restore from previous versions in the version history of the library. It made no difference.

When I saw the error, I recognized this immediately that something had been unghosted (ie was now serving the code from the content database and not the filesystem). The SharePoint page parser was now recognizing that there was inline script (as file-system served files are inherently trusted and content database files are inherently untrusted) - and it was failing.

The fix was to just reset the specific page to the site definition to effectively reghost it (so it was the same as the one deployed by the original feature). The steps are:
  1. Start Internet Explorer.
  2. Browse the SharePoint site to locate Site Actions.
  3. Click Site Actions, and then click Site Settings.
  4. On the Site Settings page, click Reset to site definition under the Look and Feel option.
  5. On the Reset Page to Site Definition Version page, type URL for the home page (in the 'Reset specific page to site definition version' textbox (e.g. /_catalogs/masterpage/CompanyNameHomePage.aspx , and then click Reset to reset the page to the site definiton version (and re-ghosting the page)


This resolved the issue immediately and I had a call just 10 seconds later thanking me for fixing it :o).


DDK

2 comments:

Unknown said...

Thanks a lot, it helped me ...
I am Happy...

SaMolPP said...

Thanks very much!! this post helped me resolving the same issue in my SP 2013 search center site.