In this post we will discuss how to resolve the error An error occurred during the processing of /siteurl/searchcenter/default.aspx. Code blocks are not allowed in this file. which comes in search center site default.aspx page.
You may also read:
– PowerShell to know site created date SharePoint 2013
– SharePoint 2016 new features
– SharePoint 2013 Implement RunWithElevatedPrivileges with Apps(S2S)
Recently while working in a migration project, I found an error while trying to open a search center site. The error coming as:
Sorry, something went wrong
An error occurred during the processing of /siteurl/searchcenter/default.aspx. Code blocks are not allowed in this file.
Troubleshoot issues with Microsoft SharePoint Foundation.
Correlation ID: e81c4a9d-7ea9-a03f-6251-c9c00b1ce67d
Date and Time: 12/10/2015 10:01:57 PM
Approach I tried:
I have created another search center site by using the “Basic Search Center” template. That site opened and worked perfectly. But then I changed from seattle master page to my custom master page. Again the same error occured.
What I feel here is if you have created the search center site by using “Basic Search Center” template then it gives this error.
Solution I tried: (Solution-1)
What I did is, I created another site by using the “Enterprise Search Center” template. This time it works for me and also it took my custom master page without any error. For me this is the better solution I feel.
The other option you can try is Open the default.aspx page using SharePoint designer 2013. The check out and edit the file in advanced mode. Now if you will open the page you can see the below code at the starting.
WebPartManager webPartManager = SPWebPartManager.GetCurrentWebPartManager(this.Page);
if (webPartManager != null && webPartManager.DisplayMode == SPWebPartManager.BrowseDisplayMode)
Just remove the above StyleBlock from the Default.aspx page (Remember to take a backup of the file before removing). Save the page.
After refresh if it did not work, then just remove the search web part and add it again it will work.
Hope this will be helpful.
Download FREE SharePoint 2019 Installation PDF Guide
This FREE PDF contains, Steps by step guide to install SharePoint 2019 Preview, prerequisites, hardware and software new features. First impression to SharePoint Server 2019 new modern site, modern lists and modern document libraries.