ASP.Net Error - Type Incompatible with Control Type

I have a website created using the web version of VS2012,

Launching the VB.net asp website,

In VS2012 debug / release mode, it compiles and everything works well. When I upload it to the server (Windows Server 2008 R2), I get the following error:

The base class includes the field 'html', but its type (System.Web.UI.HtmlControls.HtmlElement) is not compatible with the type of control (System.Web.UI.HtmlControls.HtmlGenericControl). Line 2: Line 3: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> Line 4: <html id="html" xmlns="http://www.w3.org/1999/xhtml" dir="ltr" runat="server"> Line 5: <head id="Head1" runat="server"> Line 6: <title></title> 

I looked a bit on the Internet and found this: VS 2010: A value like 'System.Web.UI.HtmlControls.HtmlGenericControl' cannot be converted to 'System.Web.UI.HtmlControls.HtmlTableRow'

Installed it, but without help,

The site I created was re-created from another vb.net project, so I used web.config from the old one, maybe it has something to do with it, I don’t have any “assembly” properties of this XML.

Other pages that are not related to this main page (this html tag is launched on the main page ...) work fine.

+5
source share
2 answers

OK,

So, after I tried many things that didn’t work, I found a solution, I don’t like this solution, but it works,

I went to the page.designer.vb file and then looked for the 'html' and 'Head1' properties that were created there,

There I replaced their types with System.Web.UI.HtmlControls.HtmlGenericControl

Subsequently, it worked.

A strange mistake, nothing else (including the “hot fixes” mentioned in other posts helped.

Hope this helps someone out there.

+6
source

Somehow, the designer file and layout file go out of sync, even if the types are displayed in accordance.

I changed the ID attribute of the problem control saved and rebuilt in the markup file. Then I changed it to the original identifier, saved and rebuilt.

The problem goes away!

0
source

Source: https://habr.com/ru/post/972773/


All Articles