Are you a .NET Developer or Contractor interested in working with Sitecore or Dynamics CRM?

Apply for our Mentorship Program. If accepted, we will mentor you on Sitecore and provide you with project to help you build your skills and make some money at the same time. If you are interested send your resume with details on why you want to work with Sitecore or Dynamics CRM to: Chris Williams - chris.williams@techguilds.com or Dennis Augustine - dennis.augustine@techguilds.com We look forward to working with you to achieve your goals.

Monday, June 8, 2009

Code blocks are not allowed in this file.

I got this error then came across this article to fix it. Sharepoint turns off code blocks by default.

This link explains the whole story:
http://blogs.msdn.com/kaevans/archive/2007/04/26/code-blocks-are-not-allowed-in-this-file-using-server-side-code-with-sharepoint.aspx

The fix is to add this web.config key. In the configuration/SharePoint/PageParserPaths configuration section add something like this:


VirtualPath="/pages/test.aspx" CompilationMode="Always"
AllowServerSideScript="true" />


WARNING: There is a reason why Sharepoint does this so only use it when you need it. It can be dangerous to give designers access to the file and accidentally have them edit your code.