Upgrading Sitecore 6.6 to .NET 4.5

Last week I had to update a Sitecore 6.6 site to .NET 4.5. The upgrade went just fine. After it was done, I flipped through the pages on the front end and everything looked fine. Next, I tried Sitecore to make sure everything was working. I clicked around the content editor for a good 15 minutes. Everything looked fine. Since I was already logged in due to the “remember me” feature, I didn’t notice at first that the login page was broken. After I pushed the code up, I had to log into the shared developer environment, and that’s when I saw this error:

Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: The base class includes the field ‘StartPage’, but its type (System.Web.UI.HtmlControls.HtmlGenericControl) is not compatible with the type of control (System.Web.UI.HtmlControls.HtmlIframe).

Wasn’t sure why this was happening, so I did some digging. Apparently .NET 4.5 changes the way the iframe control gets compiled. Digging around further, I found this StackOverflow post for my exact issue with Sitecore 6.6.

The solution was simple: open the file /website/Sitecore/login/default.aspx and change the “iframe” to “div” on lines 73 and 74. That way this:

<iframe id="StartPage" style="display: none;" width="300" height="150" frameborder="0" marginwidth="0" marginheight="0" scrolling="auto"></iframe>

becomes this:

<div id="StartPage" style="display: none;" width="300" height="150" frameborder="0" marginwidth="0" marginheight="0" scrolling="auto"></div>

After making that change, the beautiful Sitecore 6.6 came back. Everything seems to be functioning properly again. At the time of writing this post, it’s been a week and I haven’t seen any other issues after moving to .NET 4.5 with Sitecore 6.6.