Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
744 views
in Technique[技术] by (71.8m points)

.net - ASP.Net error - type is not compatible with the type of control

I have a web site i created using VS2012 web edition,

Running a VB.net asp web site,

In the VS2012 debug/release mode it compiles and everything works good, When i upload it to a 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 web and found this : VS 2010: Value of type 'System.Web.UI.HtmlControls.HtmlGenericControl' cannot be converted to 'System.Web.UI.HtmlControls.HtmlTableRow'

Installed it but no help,

The site i created was re-created from another vb.net project so i used a web.config with from the old one, maybe it has something to do with it, i have no "assembly" properties it this XML.

Other pages that are not related to that master page (that html tag is running on a master page...) work's fine.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

OK,

So after trying a lot of stuff that didnt work i found a solution, i dont 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 generated there,

In there i replaced their types to System.Web.UI.HtmlControls.HtmlGenericControl

Afterwards, it worked.

Weird bug, nothing else (including the "hot fixes" that are mentioned in other posts helped.

Hope this would help some one out there .


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...