An ASP.NET 2.0 bug: Cannot convert type 'ASP.login_aspx' to 'System.Web.UI.WebControls.Login'

Discussion in 'ASP.NET 2.0' started by tohidazizi, Jun 6, 2007.

  1. Error:
    Compilation Error
    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: CS0030: Cannot convert type 'ASP.login_aspx' to 'System.Web.UI.WebControls.Login'

    Source Error:

    Line 120: public login_aspx() {
    Line 121: string[] dependencies;
    Line 122: ((Login)(this)).AppRelativeVirtualPath = '~/login.aspx';
    Line 123: if ((global::ASP.login_aspx.@__initialized == false)) {
    Line 124: global::ASP.login_aspx.@__stringResource = this.ReadStringResource();

    Description:
    If
    (a) You use 'Form authentication (<authentication mode='Forms'>)' in your ASP.NET 2.0 web application; and
    (b) make the 'loginUrl', 'Login.aspx' (with Capital 'L') (<forms name='xxxxx' loginUrl='~/Login.aspx'>);
    you will encounter the above error when the web application request for login.

    When you 'Start' your web application on local machine (Using F5 or Ctrl+F5), there is no problem. But when you publish the web-application on the remote web-hosting server, with the setting 'Allowed this precompiled site to be updatable (checked)' and with a web form called 'Login.aspx', you encounter the error: <<Cannot convert type 'ASP.login_aspx' to 'System.Web.UI.WebControls.Login'>>

    Cause:
    So, the problem is obvious: Login.aspx page (with capital 'L') has a relative class called 'Login' that conflicts with 'System.Web.UI.WebControls.Login'. This bug was reported sometime ago (/connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=102543) but it seems that Microsoft has not fixed it.
    I have already (6 June 2007) encountered this error on www.discountasp.net web-hosting.

    Solution:
    Of course this is a bug in .net framework and ASP.NET 2.0 and should be fixed by Microsoft, but there is some workarounds that you could use one of them:
    <ul>[*]W1- Do not check 'Allowed this precompiled site to be updatable' while publishing if you have 'Login.aspx' page!
    [*]W2- Do not entitle your login page 'Login.aspx'! Call it 'login.aspx' (without capital 'L') or 'logon.aspx' or something else (remember to make necessary changes in your web.config file).
    [*]W3- Just rename the class in code-behind of 'Login.aspx' (solution for advance developers).<ul>/ul>[/list]
     
  2. Bruce

    Bruce DiscountASP.NET Staff

Share This Page