将博客园程序升级到ASP.NET 2.0之后,打开分类页面,出现错误:
     Parser Error 
     Description: An error occurred during the parsing of a resource required to service this request. Please review the     following specific parse error details and modify your source file appropriately.
Parser Error Message: Ambiguous match found.
     Source Error: 
     Line 1:  <%@ Control Language="c#" Inherits="Dottext.Web.UI.Controls.EntryList" %>
     Line 2:  <%@ Import Namespace = "Dottext.Framework" %>
     Line 3:  <h2><asp:Literal ID = "EntryCollectionTitle" Runat = "server" /></h2>
            
     博客园的程序是通过VS 2005 Web Application Project编译的,EntryList是一个用户控件。
     而之前我直接将ASP.NET 1.1版的博客园程序运行于ASP.NET 2.0时,也遇到过这个问题
     后来发现问题竟然是EntryList.ascx.cs中变量名在不区分大小写时重名引起的。
     引起问题的两个变量名是:    

关于“Ambiguous match found”protected System.Web.UI.WebControls.Repeater Entries;
关于“Ambiguous match found”
private ArrayList entries;
关于“Ambiguous match found”

     这两个变量名大小写不同,从语法上说应该是不同的变量名,所以编译时没问题,不知为什么运行时会出现问题?真是奇怪。我也没找出问题的具体原因,要想找出原因需要对ASP.NET 2.0中页面动态编译的代码进行仔细的研究。
     解决方法很简单,只要将其中一个变量改名就行了。

相关文章:

  • 2022-02-24
  • 2022-12-23
  • 2021-12-10
  • 2021-10-28
  • 2022-12-23
  • 2022-12-23
  • 2022-01-14
  • 2021-12-05
猜你喜欢
  • 2021-04-14
  • 2021-06-01
  • 2021-07-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案