http://svengillis.blogspot.com/2008/03/code-block-are-not-allowed-in-this-file.html
Code Block are not allowed in
this file
If you want to add some inline code in a masterpage or
pagelayout file... you probably get the following error message:
An error occurred during the processing of blabla.aspx. Code blocks are not allowed in this file.
<.pageparserpaths>
<.pageparserpath virtualpath="/_catalogs/masterpage/*" compilationmode="Always" allowserversidescript="true" includesubfolders="true".>
<./pageparserpaths>
An error occurred during the processing of blabla.aspx. Code blocks are not allowed in this file.
To get this working you need to modify the web.config of your web application. For instance, if you want to allow server side script on pages from the masterpage & pagelayout gallery you have to modify the PageParserPaths into:
<.pageparserpaths>
<.pageparserpath virtualpath="/_catalogs/masterpage/*" compilationmode="Always" allowserversidescript="true" includesubfolders="true".>
<./pageparserpaths>