如果想要在masterpage或者page layout中加入inline code,你可能获得如下的错误信息:

An error occurred during the processing of youpage.aspx. Code blocks are not allowed in this file.

排除这个错误,需要修改web.conifg. 比如,如果希望所有masterpage gallery中的page layout可以运行服务器端代码,就这样修改web.config:

--------------------------------
修改web.config中的PageParserPaths节点:
<pageparserpaths>
<pageparserpath virtualpath="/_catalogs/masterpage/*" compilationmode="Always" allowserversidescript="true" includesubfolders="true".>
</pageparserpaths>

相关文章: