Share via


Eval causes error in master page after SP 2010 upgrade

I've been doing a few trial database attach upgrades by taking 2007 content databases and attaching them to SharePoint 2010. One of them had a custom master page and after upgrade returned this error:

An error occurred during the processing of /_catalogs/masterpage/Intranet.master. Code blocks are not allowed in this file. 

I tracked it down to this code block:

<%# Eval("text") %></div>

It's easy to forget but you have to manually migrate settings from the old 2007 web.config to the new one. The one that allows script blocks is:

<PageParserPaths>
<PageParserPath VirtualPath="/_catalogs/masterpage/Intranet.master" CompilationMode="Always" AllowServerSideScript="true" />
</PageParserPaths>

Other possible workarounds are to 1) remove the offending Eval (note: you'll lose functionality) or 2) change the master page to default.master by going to _layouts/settings.aspx and click the Master page link.