I recently converted a website project to a web application project in Visual Studio 2008. I finally got it to compile, and the first page (the login screen) displayed as n
Look for this:
ANY page in your project that has a missing, or different Namespace...
If you have ANY page in your project with <NO Namespace
> , OR a
DIFFERENT Namespace than Default.aspx, you will get this
"Cannot load Default.aspx", or this: "Default.aspx does not belong here".
ALSO: If you have a Redirect to a page in your Solution/Project and the page which is to be Redirected To has a bad namespace -- you may not get a compiler error, until you try and run. If the Redirect is removed or commented-out, the error goes away...
BTW -- What the hell do these error messages mean? Is this MS.Access, with the "misdirection" -- ??
DGK
My issue was simple: the Master page and Master.Designer.cs class had the correct Namespace, but the Master.cs class had the wrong namespace.
I had a similar error but not from a Conversion...
System.Web.HttpException: 'Namespace.Website.MasterUserPages' is not allowed here because it does not extend class 'System.Web.UI.MasterPage'
I was also extending the MasterPage class.
The error was due to a simple compilation error in my Master Page itself:
System.Web.HttpCompileException: c:\directory\path\Website\MasterUserPages.Master(30): error CS1061: 'ASP.masteruserpages_master' does not contain a definition for 'btnHelp_Click' and no extension method 'btnHelp_Click' accepting a first argument of type 'ASP.masteruserpages_master' could be found (are you missing a using directive or an assembly reference?)
I was not able to see the error until I moved the MasterPage to the root website folder. Once that was taken care of I was able to put my MasterPage back in the folder I wanted.
I delete that web page that i want to link with master page from web application,add new web page in project then set the master page(Initially I had copied web page from web site into Web application fro coping that aspx page (I was converting website to web application as project))
I had copied and renamed the page (aspx/cs). The page name was "mainpage" so the class name at the top of the cs file as follows:
After renaming the class to match this error was resolved.
You can always refractor the namespace and it will update all the pages at the same time. Highlight the namespace, right click and select refractor from the drop down menu.