Probably a late reply but placing the .net code between de telerik code blocks works fine for me. The .net error doesn't show up any more. In my example I use a randomizer which doesn't work when the radcodeblocks are not placed.
Even when the "Head" has the attribute runat="server", I have no problems.
Example, just placed this in my PageLayout.
<head id="Head1" runat="server">
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
background-image: url('/Style%20Library/Parentix/img/homeimage<%Random random = new Random(); System.Web.HttpContext.Current.Response.Write(random.Next(1, 5));%>.png');