Error: Code-blocks are not allowed in this file

I have experienced this error when I inserted some server side code into a SharePoint page. The reason for this is, the web server is configured for not to allow server side code in pages. You can modify this configuration in the web configuration file as described below.

Open web.config file and put the following code block in it.

  <PageParserPath VirtualPath=”/pages/test.aspx” CompilationMode=”Always” AllowServerSideScript=”true” />


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s