2

I was trying to remove the site logo from our search results page and now the page won't load.

The first error I got was: enter image description here

I searched for this and found where you can modify the web.config file to add a SafeControl for this and also add a section under PageParserPath for the searchresults.aspx file and allow server side scripts. This still gives me the following error message:

enter image description here

Here is what I added to the web.config file:

 <PageParserPath
 VirtualPath="/_catalogs/masterpage/searchresults.aspx"
 CompilationMode="Always" AllowServerSideScript="true"
 />

I have also tried to reverted the code to remove the Site logo, tried restoring the searchresults.aspx to an earlier version, copied code from another site searchresults.aspx to this one and tried resetting the site definition. Although I wasn't able to reset just the searchresults.aspx page, it said it couldn't find it.

I'm kind of stuck now because I'm sure how to fix that Code Blocks error or how to even revert this back to it's original settings. I'm pretty sure the problem is in the searchresults.aspx file because that error wouldn't show up for regular users until I checked it out/in. After that it wouldn't show for anyone.

Any help would be greatly appreciated. Thanks in advance!

  • There should be something more than what it is displayed on the screen. So take a look at ULS log files for more information. – Amal Hashim May 5 '15 at 15:42
  • Unfortunately I looked there but didn't find much else in those logs. Below is the full error message in the ULS logs: Application error when access /search/Pages/results.aspx, Error=Code blocks are not allowed in this file. at System.Web.UI.TemplateParser.EnsureCodeAllowed() at System.Web.UI.TemplateParser.ProcessCodeBlock(Match match, CodeBlockType blockType, String text) at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding) at – DougS May 5 '15 at 17:47
  • and this is the rest: System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding) – DougS May 5 '15 at 17:49
  • Apparently if you edit the searchresults.aspx page it corrupts something somewhere and can't be easily resolved. I found a workaround by creating a another site collection under the main and used it to display the search results since it's weren't corrupted. – DougS May 6 '15 at 15:37
  • Have you tried resetting the page layout to site definition – Asad Refai May 6 '15 at 16:25
1

If you are looking for reverting back your changes then, I guess resetting the page layout to its Site Definition can help.

1. Open your site in SP Designer

2. Click on Page Layouts tab on left hand menu

3. Select the SearchResults.aspx

4. From the ribbon control, in Actions section, click on Reset to Site Definition button.

This will revert back your changes and hopefully you will get your page layout working.

I hope this helps

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.