When you create an ASPX page in Sharepoint (for example in Sharepoint Designer), you might get the error 'Code-Blocks are not allowed in this file' when you run the page. This is because SharePoint disables the ability to create server-side script by default, you have to turn it on.

You can do this by modifying the web.config; in the configuration/SharePoint/PageParserPaths configuration section:

<PageParserPaths>
   <PageParserPath VirtualPath="/pages/mypage.aspx" CompilationMode="Always" AllowServerSideScript="true" />
</PageParserPaths>

After saving the web.config and a reload of your page, the error should be gone.