Posts Tagged 'MOSS 2007'

Code block not allowed in your SharePoint Master Page error

"Code blocks are not allowed in this file"

Code blocks are not allowed in this file

I’m posting this now because I just ran into it for a second time, but had completely forgotten what the issue was when I googled it the first time.  So I’m posting it here for my convenience, mostly!

If you suddenly start getting an exception from SharePoint stating that code blocks aren’t allowed in your master page, you need to add a new <PageParserPath> element to web.config to allow the code.  Why this starts happening all of a sudden when the same code block existed in the path previously without the exception, I will never understand.  But the point is, follow the directions in one of these blog postings to resolve it:

http://mystepstones.wordpress.com/2009/02/13/code-blocks-are-not-allowed-in-this-file/

http://svengillis.blogspot.com/2008/03/code-block-are-not-allowed-in-this-file.html

http://dotnetdeveloper.co.uk/blogs/sharepoint/archive/2008/10/10/code-blocks-are-not-allowed-in-this-file.aspx

Advertisements

Scott’s recent tweets…

Advertisements