8/12/11

Allow Code Blocks in a Sharepoint ASPX page


If you experience the following error message on a Sharepoint page that is trying to execute custom code, there is a web.config setting to allow the custom code.

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

Reason: SharePoint does not allow server side code to execute in aspx pages contained in the SharePoint site.

Corrective Action: Edit the web.config

<PageParserPaths>
<!-- To allow a single file: -->
<PageParserPath VirtualPath="/mypage.aspx" CompilationMode="Always" AllowServerSideScript="true" />
<!-- To allow global: -->
<PageParserPath VirtualPath="/*" CompilationMode="Always" AllowServerSideScript="true" />
<!-- To allow global within a subsite: -->
<PageParserPath VirtualPath="/mywebsite/*" CompilationMode="Always" AllowServerSideScript="true" />
</PageParserPaths>

No comments:

Post a Comment