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

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

Old forum URL: forums.lhotka.net/forums/t/872.aspx


joemagicdeveloper posted on Thursday, August 10, 2006

    Hi all,

I'm testing the PTWeb and I'm getting this error. Something wrong with the Login.aspx ( I get the error both inside VS and running the application properly from the browser/IIS).

Any clues? (I'm digging the book but so far...)

Cheers


details:

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 118:        public login_aspx() {
Line 119:            string[] dependencies;
Line 120:            ((Login)(this)).AppRelativeVirtualPath = "~/Login.aspx";
Line 121:            if ((global::ASP.login_aspx.@__initialized == false)) {
Line 122:                dependencies = new string[2];
 



lukejackson replied on Wednesday, August 16, 2006

This can be caused by your Code Behind class being called Login - this clashes with System.Web.UI.WebControls.Login and when the page is loaded it loads up that class rather than your page.  You should simply rename the class of the Code Behind, updating the Inherits property on the page itself, or alternatively use a namespace for the Login page class and change the Inherits property to refer to the page using the namespace.

See http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=102543 for more details.

david.wendelken replied on Monday, October 23, 2006

V2.1 C#

I'm getting the same problem.  I've googled and tried the following, but it still fails:

1) renamed Login class to PTLogin in Login.aspx.cs.

2) set the Inherits property to PTLogin from Login in Login.aspx.

3) changed the PTWeb project property to not an updateable website.

4) exited visual studio, cleared out the shadow directories, and restarted visual studio.

still have the problem.

any other ideas?

ps - and it would be a good idea to change whatever is needed in the sample project so this isn't an issue... :)

david.wendelken replied on Tuesday, October 24, 2006

I've been fighting this all day and still no progress!

Doesn't matter what I try to do, the login control still wants to cast it to a Login class and it can't.

Help!

 

david.wendelken replied on Tuesday, October 24, 2006

The project tracker shadow directories (with code generated by visual studio) are chock full of code that has ~\Login.aspx embedded in it.

It's coming from the <asp:Login> control on the master page, but I can't figure out how to make it use a different file name. 

david.wendelken replied on Tuesday, October 24, 2006

Ok, I finally figured this darn situation out.

The problem was that the project tracker web code was in two places, my project directory and in inetpub\wwwroot\ptweb.

I was changing the code in my project directory but running the code in inetpub.  Once I (re?)published it with the changed login page class name, it worked just fine.

I still think the sample project should avoid the Login class name to begin with!

Copyright (c) Marimer LLC