How to solve “Code blocks are not allowed in this file” error?


if you are getting “Code blocks are not allowed in this file” error while browsing a page in SharePoint then it is because SharePoint disables the server code in script block. This is to make sure that no one should just upload an aspx page with malicious server side code and execute it to kill the SharePoint server :):)

craft essays antabuse purchase go site kamagra oral jelly price india liquid viagra from thailand compare tadalafil and sildenafil follow site source site source url scientific research paper template word work and stress essay essay on terrorism causes effects and solutions cheap viagra online reviews good and bad habits essay go here click here essay examples vacation good qualities of research paper go site expository essay sample for kids click here help save the environment essay OK, got it….now tell me how to allow server code in a specific page?

Here you go, just add following PageParserPath nodes under PageParserPaths node.  Refer below for an example:

        <!-- Following page has code in script -->
        <PageParserPath VirtualPath="/pages/test.aspx" CompilationMode="Always" AllowServerSideScript="true" />


1 thought on “How to solve “Code blocks are not allowed in this file” error?”

  1. I have read this solution on many blogs but it did not work for me. Am I determining the virtual path incorrectly? I have two site collections and this one should point to only one of them, but I keep getting the error!


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share via
Copy link
Powered by Social Snap