Code blocks are not allowed in this file

Whenever you encounter this error, when having Server Side Script in your custom ASPX Page stored in your Pages Library, you just need to add this line in your site's web.config.

Do not forget to replace the VirtualPath to point to the folder or library which has those pages.


<PageParserPath VirtualPath="/sites/TestSites/page/*" CompilationMode="Always" AllowServerSideScript="true" />



  1. I am still having the error after including this in the web.config file. I am working on SharePoint 2010. Any additional input on this

  2. Hope you did a iisreset after you modified, obviously also make sure, the virtualPath is modified.


Post a Comment

Popular posts from this blog

Using External Content Types with Stored Procedures with Input Parameters

HTTPS Site InfoPath Issue : You do not have permissions to access a web service that provides data required for this form to function correctly

Windows 7 Blue Screen because of ConnectiFy