Feed Icon  

Contact

  • Bryant Likes
  • Send mail to the author(s) E-mail
  • twitter
  • View Bryant Likes's profile on LinkedIn
  • del.icio.us
Get Microsoft Silverlight
by clicking "Install Microsoft Silverlight" you accept the
Silverlight license agreement

Hosting By

Hot Topics

Tags

Open Source Projects

Archives

Ads

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

Posted in ASP.Net/Web Services at Wednesday, December 14, 2005 2:26 AM Pacific Standard Time

I ran into this issue today when working on a personal site that I'm developing with ASP.Net 2.0. The error is not very descriptive and it took a little hunting to find this explanation by sholder:

I hit the same issue just now...and you are the only one I could find
who was having the same problem. The good news is I figured it out...I
thought it might have to do with the name of the page (based on the
error we were both receiving). I renamed my page from Login.aspx to
MemberLogin.aspx. I recompiled and deployed. Everything worked!!!!

So it seems the issue is with the fact that both types are Login so ASP.Net fails when it tries to run it. However, instead of renaming my login page I was able to get around the error by unchecking “Allow this precompiled site to be updatable”. So I'm guessing the issue (which apparently didn't exist in beta 2) is do to some of the magic that allows you to update your DLL files without updating your aspx files.

Wednesday, March 15, 2006 2:20:19 PM (Pacific Standard Time, UTC-08:00)
Thanks for the info.

Seth Webster
Wednesday, March 29, 2006 2:04:43 AM (Pacific Standard Time, UTC-08:00)
I just encountered this same issue and your solution worked perfectly. THANK YOU!
Zonker
Wednesday, March 29, 2006 9:00:13 PM (Pacific Standard Time, UTC-08:00)
thank you very much... i had the same problem and this fixed it!
Saturday, September 02, 2006 3:56:38 PM (Pacific Daylight Time, UTC-07:00)
Great thing about 'updatable'.

Thanks!
Thursday, September 14, 2006 6:16:47 AM (Pacific Daylight Time, UTC-07:00)
Hi, Guys.

Actually, what worked for me is to simply change the name from Login.aspx to login.aspx. You'll notice the return URL is looking for login.aspx that begins with a small letter "L".

--Harry
Harry
Wednesday, November 22, 2006 1:09:28 AM (Pacific Standard Time, UTC-08:00)
Thanks, I couldn't find a solution from Microsoft or experts exchange.
RonStat
Sunday, December 17, 2006 2:59:41 AM (Pacific Standard Time, UTC-08:00)
Great! Renamed the page to UserLogin.aspx (the name doesn't really matter ;)) Thanks!
Jonas
Saturday, February 17, 2007 11:30:08 AM (Pacific Standard Time, UTC-08:00)
Harry, thanks for your post, it would have taken me a long time to figure this error out. The problem is that the code-behind class that the Login.aspx is inheriting from is named Login (capital L) so ASP.NET confuses the class file with the actual Login control, so that's why we get the type cast error.
Angel Arce
Saturday, March 03, 2007 6:03:42 AM (Pacific Standard Time, UTC-08:00)
Ha, yeah this was getting me too. damn VS and is suspiciously nice sounding checkbox options "updatable" by which MS actually meant ... "totally unusable". Ha. Thanks
Ben
Friday, March 23, 2007 9:18:23 PM (Pacific Standard Time, UTC-08:00)
thank you very much
AnhPT
Tuesday, April 10, 2007 11:57:37 AM (Pacific Daylight Time, UTC-07:00)
This solved it. Thx!
joo
Sunday, April 29, 2007 3:30:36 PM (Pacific Daylight Time, UTC-07:00)
Thanks for sharing this; this entry is the second hit in google when searching for the text of the error message.
Tuesday, May 01, 2007 5:19:56 PM (Pacific Daylight Time, UTC-07:00)
Works fine, thanks a lot for the info!
Gasys
Sunday, May 13, 2007 11:56:19 PM (Pacific Daylight Time, UTC-07:00)
Thank you very much. Your solution worked great
Mat
Thursday, June 07, 2007 1:18:43 AM (Pacific Daylight Time, UTC-07:00)
I created a Web Site project in VS 2005 with a login page called Login.aspx. Late into the project I had to convert it from a Web Site project to a Web Applications project (don't even ask). After doing so I was getting this error. I then ran across this blog of yours, but I was unable to find the “Allow this precompiled site to be updatable” option in the MSBuild Options becase Web Applications DOES NOT HAVE THAT PROPERTY PAGE!! I couldn't believe it. My solution was to go and rename my Login.aspx to login.aspx, and it worked. Notice that the only difference is the lowercase l in login.
Tyson Hansen
Friday, June 15, 2007 5:41:03 AM (Pacific Daylight Time, UTC-07:00)
Thanks. I had been struggling with this one for a while
James
Monday, June 25, 2007 5:38:58 AM (Pacific Daylight Time, UTC-07:00)
same issue..did not want to rename the file, instead renamed the CLASS the codebehind inherits from

ie

public partial class Login : System.Web.UI.Page

to

public partial class _Login : System.Web.UI.Page

and

CodeFile="Login.aspx.cs" Inherits="Login"

to

CodeFile="Login.aspx.cs" Inherits="_Login"
dmose
Tuesday, August 28, 2007 1:11:56 AM (Pacific Daylight Time, UTC-07:00)
I had the problem on a page called CreateAccount.aspx. This file didn't require anything special and the web site had already been compiled without the check box on 'make this site updateable'. It happens sporatically, anyone find any other solutions?
Miles
Wednesday, September 05, 2007 11:01:02 PM (Pacific Daylight Time, UTC-07:00)
thanks..
Lloyd
Monday, September 10, 2007 12:25:26 AM (Pacific Daylight Time, UTC-07:00)
Changing the capitalisation of the class name for the page from "Login" to "login" did it for me!

Thanks Harry!
Wednesday, September 26, 2007 8:16:56 PM (Pacific Daylight Time, UTC-07:00)
You can put your page into some namespace, i.e.:
namecpase BlahBlah
{
public partial class Login : System.Web.UI.Page
{
....
Alexander
Thursday, October 11, 2007 5:43:19 AM (Pacific Daylight Time, UTC-07:00)
I tried all, putting the page into a namespace, changing the name, even changin the class name and nothig... but then i realized of unchecking the option of "Allow this precompiled site to be updatable" and worked perfectly. Thanks for the post
Lobch
Wednesday, November 14, 2007 6:21:41 PM (Pacific Standard Time, UTC-08:00)
Thanks a lot for this info.

Just to let you know that I had the same problem but with a user control.

CS0030: Cannot convert type 'ASP.menu_ascx' to 'System.Web.UI.WebControls.Menu'

changing its name solved it :)
Kevin
Tuesday, November 20, 2007 12:08:26 PM (Pacific Standard Time, UTC-08:00)
i think the best practice is to have a namespace for all your pages and user controls.

E.g. Because you may create pages like "Checkbox.aspx" or "TextBox.aspx"
valamas
Wednesday, November 28, 2007 5:34:28 PM (Pacific Standard Time, UTC-08:00)
thanks login_aspx'
Monday, March 24, 2008 2:01:37 PM (Pacific Standard Time, UTC-08:00)
Is there any other way other than renaming the page.
Roni
Wednesday, March 26, 2008 1:59:43 PM (Pacific Standard Time, UTC-08:00)
I just Add a line in code behind

namespace Mylogin
{
..
.
... <your code>
.
}

And then I changed the inherit phrase just as
inherits = "Mylogin.login"

It starts working.

Danish
Thursday, June 12, 2008 3:14:49 PM (Pacific Daylight Time, UTC-07:00)
Thanks very much ..
unchecking the 'updatable' solved my issue.
i would never have figured it out
Salim
Thursday, June 26, 2008 7:53:13 AM (Pacific Daylight Time, UTC-07:00)
You can put your page into some namespace, i.e.:

namecpase BlahBlah

{

public partial class Login : System.Web.UI.Page

{

....

Monday, August 04, 2008 9:55:22 PM (Pacific Daylight Time, UTC-07:00)
thanks
Saturday, August 23, 2008 1:48:50 AM (Pacific Daylight Time, UTC-07:00)
Thanks a ton
Tarun
Sunday, November 16, 2008 3:13:26 AM (Pacific Standard Time, UTC-08:00)
I'm guessing the only way to do this in Javascript would be to use the onresize event, and then using the resizeTo method to attempt to keep the window at the size you want?
Monday, December 15, 2008 2:49:34 AM (Pacific Standard Time, UTC-08:00)
Thank a lot............As error was not specific, it was really difficult to find the solution....Unchecking"Allow this precompiled site to be updatable" resolved my problem..
Rajanee
Friday, May 01, 2009 7:21:23 PM (Pacific Daylight Time, UTC-07:00)
it really works.
amit vaidh
Tuesday, May 26, 2009 11:46:14 PM (Pacific Daylight Time, UTC-07:00)
I'm guessing the only way to do this in Javascript would be to use the onresize event, and then using the resizeTo method to attempt to keep the window at the size you want?
Estetik
Comments are closed.