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.






<PageParserPaths>



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


</PageParserPaths>


Comments

  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

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

    ReplyDelete

Post a Comment

Popular posts from this blog

Using External Content Types with Stored Procedures with Input Parameters

Validate a SharePoint Date Field against Current Date in Javascript