系统里有一个叫Login.aspx的文件,开发测试的时候没有任何问题,发布网站,运行时提示"无法将类型“ASP.login_aspx”转换为“System.Web.UI.WebControls.Login",页面上更本就没有Login控件,于是我将发布改为不允许更新此预编译站点发布后正常,于是找了一些资料,发现有个解决方法,If you have used a Page that effectively uses a codebehind classname 
that is the same as say the Login control, that is Login, e.g. your 
page was called Login.aspx, then when you pre-compile (publish) the web 
site as an updateable web site, the aspx is retained and tries to 
compile against a type called Login in the code behind. It does not 
resolve to be that in the codebehind assembly Try using a classname for your codebehind and defined in the inherits 
that does not clash with a type in System.Web, e.g. LoginPage, or 
qualify the class and therefore the inherits statement with a 
namespace, e.g. <%@ page ... inherits="theNs.Login" %. namespace theNs { public partial class Login : System.Web.UI.Page { .. 
} } 不知道各位有没有碰到过这样的问题...

解决方案 »

  1.   

    If you have used a Page that effectively uses a codebehind classname 
    that is the same as say the Login control, that is Login, e.g. your 
    page was called Login.aspx, then when you pre-compile (publish) the web 
    site as an updateable web site, the aspx is retained and tries to 
    compile against a type called Login in the code behind. It does not 
    resolve to be that in the codebehind assembly 说的很清楚了~~Codebehind的aspx如果叫Login就有这个麻烦
    应该算是BUG,Framework的BUG
      

  2.   

    还没有用过.net 2.0
    呵呵
    不过估计是bug