Pular para o conteúdo principal

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

The basic problem is an incompatibility between the object generated from your Web Forms IFRAME server control by the ASP.NET compiler (which compiles ASPX and ASCX files to C# or VB code) and the type of the variable corresponding to that control in your Web Forms code behind. An IFRAME server control (<iframe id="frame" runat="server" />) will be parsed as an control of a particular type. In ASP.NET 4 an IFRAME server control will be an HtmlGenericControl control. In ASP.NET 4.5 an IFRAME server control will be an HtmlIframe control.
The problem can be fixed by making sure that the targetFramework attribute on the compilation element in your web.config file agrees with the Target Framework property of your project and that the variable corresponding to your IFRAME server control matches the type of control the ASP.NET compiler will generate.
An ASP.NET 4 project that has been converted to .NET Framework 4.5 in Visual Studio 2013 will modify the project's web.config file so that targetFramework attribute of the compilation element has a value of "4.5" (<compilation targetFramework="4.5"/>). This causes the ASP.NET compiler to treat the IFRAME server control as a HtmlIframe control. This can cause a problem if the Web Forms code behind control variable is still an HtmlGenericControl. The error you see is like this:
The base class includes the field 'frame', but its type (System.Web.UI.HtmlControls.HtmlGenericControl) is not compatible with the type of control (System.Web.UI.HtmlControls.HtmlIframe).
The solution to the previous error is to update the type of the server control variable that corresponds to the IFRAME server control. You can do this by re-saving the Web Forms HTML file which will cause the designer file to be regenerated. As far as I can see (in Visual Studio 2013 at least) changing the control ID is not necessary. If the server control variable is in the code behind file, it must be updated manually.
An ASP.NET 4.5 project where the code behind variable is an HtmlIframe will experience a similar but different issue if the targetFramework attribute of the compilation element in the web.config file has a value of "4.0" (<compilation targetFramework="4.0"/>). This causes the ASP.NET compiler to treat the IFRAME server control as a HtmlGenericControl control. The error you see is like this:
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).
The way to fix the previous error is to make sure the web.config compilation settings agree with your project's Target Framework attribute. In this case the targetFramework attribute of the compilation element in the web.config should have a value of "4.5".
<compilation targetFramework="4.5"/>

Solution:
You need to add below tag in .aspx.
<asp:HtmlIframe>
In the file designer (*.designer.cs) change the control type to
System.Web.UI.HtmlControls.HtmlIframe
Add the below line in ur Web.config
<controls>
 <add tagPrefix="asp" namespace="System.Web.UI.HtmlControls" assembly="System.Web"/>
</controls>

Comentários

Postagens mais visitadas deste blog

A batalha por uma SafeKid (Unicamp)

Figura 1 - Cadeira Safekid (Unicamp) Nas consultas usando a ferramenta de busca do Google obtive os seguintes link para a tal cadeira. 1- http://revistacrescer.globo.com/Crescer/0,19125,EFC1010380-2213-2,00.html 2- http://www.ibiubi.com.br/produtos/cadeira-cinto-de-seguran%c3%a7a-safekid-projetado-pela-unicamp+beb%c3%aas-e-crian%c3%a7as+cadeiras/IUID4138740/ 3- http://compras.hsw.uol.com.br/assento-infantil-guia.htm 4- http://produto.mercadolivre.com.br/MLB-123086053-cadeiracinto-de-seguranca-safekid-projetado-pela-unicamp-_JM a própria! só que venda finalizada. Foi então que resolvi procurar no Bing (Microsoft) www.bing.com. Também não encontrei! Rs Encontrei algumas parecidas a preços imbatíveis, mas fora do país. 1- http://www.magazineluiza.com.br/produto/index_Produto.asp?Produto=1766074&linha=BB&Setor=CADA&modelo=08 2- http://www.precomania.com/search_attrib.php/page_id=1990/st=page/page=1 Mas foi no Yahoo buscas que eu encontrei a dita cuja. Quero dizer, um possível ...

Driver para Receptor de TV Digital da Multilaser RE003

Email recebido da central de atendimento da Multilaser para resolver problema de funcionamento do receptor digital em Windows 7. --------------------------------------------------------------------------------- Prezado(a) Cliente, Primeiramente pedimos desculpas por quaisquer transtornos causados. Segue anexo manual passo a passo para a instalação do RE003. Conseguimos desenvolver um novo software para o aparelho, pois o enviado no cd não estava conseguindo localizar canais. Peço a gentileza de seguir o passo a passo e me informar se conseguiu utilizar o produto. Os drivers que irá precisar estão disponíveis no link http://tinyurl.com/j3w3svn Os drivers que irá precisar estão disponíveis no link  http://tinyurl.com/j3w3svn Os drivers que irá precisar estão disponíveis no link  http://tinyurl.com/j3w3svn Instale os drivers e o software Presto! Serial: EVALUATION

EmguCV DLL Not Found Exception -Unable to find cvextern?

Eu também tive os mesmos problemas. Neste fórum emgucv , não sei por que cvextern.dlldo emgucv 3.4.3 não é possível carregar cvextern (porque não é possível encontrar cvextern), e você permitiu usar o arquivo cvextern.dlldo emgucv 3.4.2 (certifique-se de escolher x64 / x86), copie /bin/Debuge este arquivo é encontrado automaticamente /bin/Debug/x86ou /bin/Debug/x64quando você termina de construir o programa no Visual Studio.  O Erro:  The type initializer for 'Emgu.CV.CvInvoke' threw an exception. : Unable to load DLL 'cvextern': The specified module could not be found. (Exception from HRESULT: 0x8007007E)  Para resolver o problema copia a pasta x64 ou x86 para dentro da pasta bin da aplicação. Ou copie os arquivos para dentro da pasta bin da aplicação WCF.