Had a really frustrating error in the web project where the following error message appeared...
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
I looked through my application and saw that I had the following code....
<head id="Head1" runat="server">
<asp:ContentPlaceHolder ID="ScriptExtra" runat="server"></asp:ContentPlaceHolder>
but I also inject into the header Meta information and title pages from my application using a nice little function to keep our Meta information in check.
As a result - I needed to change all references from
As I result I needed to change all my headers that are runat="server" to use
I needed to change all references that are found in the head from an equals to a hash.
I used the following regular expression to find all references of a head with a runat server...