Code blocks are not allowed in this file – running pages with inline code in sharepoint

If you upload a standard page with inline code to a document library on your sharepoint installation, you will properly get the above error message.

To avoid it, do the following:

Open the sitecollections web.config placed somewhere around here:


Go to the tags


And put this in between.


<PageParserPath VirtualPath=/*





It is now possible to run code from all your document libraries. For many obvious reasons, this is a really bad idea 🙂 But it can come in handy on your development machine.

If you just want to allow it for a single page(For instance a master page), change virtual path to point directly to that page.