Cannot convert type 'ASP.login_aspx' to 'System.Web.UI.WebControls.Login'
Posted by Ryan Baxter Thu, 28 Feb 2008 18:38:00 GMT
Just a quick fix. If you’re experiencing the error message, Cannot convert type ‘ASP.login_aspx’ to ‘System.Web.UI.WebControl, try renaming your page from Login.aspx to something else.
I ran across this earlier this morning when attempting to deploy an ASP.NET 2.0 WebSite project. My code worked great locally (isn’t that always the case). I haven’t had time to really dig into why this happens, but maybe someone else can provide an answer.
- Meta no trackbacks, no comments, permalink, rss, atom
Expect the Unexpected: bool IsInRole(string role)
Posted by Ryan Baxter Tue, 10 Jul 2007 02:34:00 GMT
Running some tests yesterday, I was alarmed by an Exception that read, “The trust relationship between the primary domain and the trusted domain failed.” What?!? This code worked a few weeks ago! The method in question called Page.User.IsInRole(“DomainName\RoleName”) to determine if a user was assigned to an administrator’s role. bool IsAdministrator(). Simple and efficient. Why is this happening?!?

In short, the role that I was supplying Page.User.IsInRole with contained a typo. What is interesting is the results of my test case found below. Pay attention to the method signatures and their outcome.
Page.User.IsInRole(“DomainName\RoleName”) returns true
Page.User.IsInRole(“RoleName”) returns true
Page.User.IsInRole(“DomainName\TypoRoleName”) returns false
But…
Page.User.IsInRole(“TypoRoleName”) throws the Exception
Huh?
I haven’t had time to dig further into this, but I’d definitely be interested in hearing some opinions.
- Posted in Expect the Unexpected
- Meta 4 comments, permalink, rss, atom

