After upgrading a solution from 6.6 to 7.5, I got the white screen of death when I tried to logon to the sitecore client.
Error
The base class includes the field ‘StartPage’, but its type (System.Web.UI.HtmlControls.HtmlIframe) is not compatible with the type of control (System.Web.UI.HtmlControls.HtmlGenericControl)
With the release of .net 4.5, they introduced a new control to represent a IFRAME (i.e. the html tag shown below) server control called HtmlIframe.
<iframe id="frame" runat="server" />
Therefore depending on the framework version used for compilation 2 different types of control will be created:
- In ASP.NET 4.0 or earlier an IFRAME server control will be represented by a HtmlGenericControl control.
- In ASP.NET 4.5 an IFRAME server control will be represented by a HtmlIframe control.
And this is what cause the error above, my application was compiling for .net 4.0 and therefore did not match the control in the sitecore dll which is compiled for .net 4..5
Solution
The targetFramework attribute of the compilation element in the web.config defines which framework should be used, see below.
Unfortunately due to another module in the upgraded solution the target framework attribute was removed, and therefore defaulted to .net 4.0 and so the types did not match.
So I added the targetFramework=4.5, and the login page worked again.
I thought it was a good idea with a quick blog as I guess I won’t be the first person to run into this problem.
Awfully interesting piece
Brilliant Piece
Very interesting critique