Tuesday, October 23, 2012

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


I came to read this error: CS0030: Cannot convert type 'ASP.login_aspx' to 'System.Web.UI.WebControls.Login' in the deployed asp.net web application. Further it was working well when in the IDE Visual Studio 2005. Yeah, after having configured a virtual directory in the IIS of my machine, I had published my asp.net web application into thus configured virtual directory directly from my Visual Studio 2005 IDE. Then I tried to run it from the browser and exactly the mentioned error CS0030: Cannot convert type 'ASP.login_aspx' to 'System.Web.UI.WebControls.Login' occurred.
I searched on and found some solutions to this problem. Each of them are claimed to solve this error. I have listed them below:

  • You should rename your Login Page. Let this be LogIntoSite.aspx, the code behind being LogIntoSite.aspx.cs.
  • Add a namespace into the code behind of Login.aspx.cs. Then update the design file Login.aspx by pointing the Inherits property including this namespace. You can do it like below.

  • Uncheck the 'Allow this precompiled site to be updatable' when you are publishing your asp.net web application from the Visual Studio 2005 IDE.
    In my case, I followed the second trick, just because I loved the Login.aspx page's original name You can do any of the above to avoid the error. Happy programming!