Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Problem with type error
Guest
#1 Posted : Thursday, August 24, 2006 6:22:30 PM(UTC)
Groups:
Joined: 11/1/2005(UTC)
Posts: 278

I'm using .net 2.0 with SQLExpress (2k5) db. I'm using master pages and the MS authentication/membership tools.
I used the publish site in the VisStudio ide. When I use UtiliDev/Cassini to browse to the site initially I have no problems. Clicking on any links however redirects users to my login page which throws an error. I had done some research on this and found there is a bug in that you don't want to call your login page login.aspx due to namespace conflicts so I went back to my project and renamed my login.aspx page MemberLogin.aspx. I rebuild my site on my dev box and all is fine.

I then published the site again and tried UltiDev/Cassini and had the same problem. The error thrown is the following:

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.memberlogin_aspx' to 'System.Web.UI.WebControls.Login'

Source Error:



Line 118: public memberlogin_aspx() {
Line 119: string[] dependencies;
Line 120: ((Login)(this)).AppRelativeVirtualPath = "~/MemberLogin.aspx";
Line 121: if ((global::ASP.memberlogin_aspx.@__initialized == false)) {
Line 122: dependencies = new string[2];


Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\ce7519d1\d3059807\App_Web_memberlogin.aspx.cdcab7d2.odutkcww.0.cs Line: 120

Thanks in advance for any assistance.
Ultidev Team
#2 Posted : Thursday, August 24, 2006 6:48:13 PM(UTC)
Ultidev Team

Groups: Administration
Joined: 11/3/2005(UTC)
Posts: 2,253

Thanks: 28 times
Was thanked: 60 time(s) in 59 post(s)
Hi!

Apparently the error occurs when you cast 'this', which seems to be of type "'ASP.memberlogin_aspx", to "Login", which compiler understood as "'System.Web.UI.WebControls.Login" because you probably have "using System.Web.UI.WebControls;" statement at the top of the source file.

If by "(Login)this" casting you mean casting to a type other than 'System.Web.UI.WebControls.Login, then you either may want to provide complete type name of the "Login" class that includes namespace, or, if Login type is actually a page (public partial class Login : System.Web.UI.Page), then you may consider dropping "using 'System.Web.UI.WebControls;" statement or replacing it with alias "using WC=System.Web.UI.WebControls;" statement to remove ambiguity between Login page type and Login control type.

Please let us know if this helped.

Best regards,
UltiDev Team.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
Guest
#3 Posted : Thursday, August 24, 2006 9:18:12 PM(UTC)
Groups:
Joined: 11/1/2005(UTC)
Posts: 278

Thanks for the quick feedback.

The code that was complaining is actually generated code by .NET. So I was not able to modify the behavior it was doing as I'm using a login control on the page and it was adding the using System.Web.UI.WebControls to the aspx page. The problem ended up being the class itself was still named Login and that was conflicting with the namespace. I had used the rename function in the solution explorer to convert my Login.aspx to MemberLogin.aspx and it did a pretty thorough job even modifying my references in my VSS. It didn't however modify the class name which understandibly it left to me. This hadn't cause me problems in my dev env so I didn't notice it untill looking closer at it.

Thanks again...
Ultidev Team
#4 Posted : Friday, August 25, 2006 4:28:56 AM(UTC)
Ultidev Team

Groups: Administration
Joined: 11/3/2005(UTC)
Posts: 2,253

Thanks: 28 times
Was thanked: 60 time(s) in 59 post(s)
Thank you for clarifying this. Sorry, we didn't realize the code in question was generated.

Best regards,
UltiDev Team.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
Rss Feed  Atom Feed
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You can vote in polls in this forum.