Search code examples
asp.netiis-7.5windows-server-2008-r2

iFrame parser error after upgrading to .NET 4.5


We have recently upgraded all of our WebForms projects to .NET 4.5, and encountered a parser issue when loading pages with an iFrame element. We have corrected this by converting of the iFrame from HtmlGenericControl to HtmlIframe. This has corrected all of the parser errors when we run our code locally.

When we deploy the app, we get the following error message:

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

When I deploy the old code with the HtmlGenericControl the error goes away suggesting that even though we have installed .NET 4.5, the server is still using an older version?

I've tried removing and reinstalling .NET it making sure to register asp with IIS.

Windows 2008 R2 with IIS 7.5 and .NET 4.5


Solution

  • We were able to fix the issue converting the

    <iframe id="iframe" runat="server" />
    

    to

    <asp:HtmlIframe id="iframe" runat="server" />