MasterType problem after conversion from ASP.Net WebSite project to web application

After converting the Asp.net website to a web application, I get the message “MyNameSpace.MyMaster type not defined” on pages using the MasterType directive.

e.g. in aspx file

<%@ MasterType VirtualPath="~/MyMaster.master" %>

The following code is generated in the designer.vb file and has the error described above:

Public Shadows ReadOnly Property Master() As MyNameSpace.MyMaster
    Get
        Return CType(MyBase.Master, MyNameSpace.MyMaster)
    End Get
End Property

If I remove the namespace, the error will disappear, but this code will be regenerated every time I make changes on the aspx page.

If I use TypeName without a namespace (for example, Typename = "MyMaster") instead of VirtualPath in the directive, the code is generated without a namespace reference and, therefore, without errors. However, this is not performed at run time. Enabling a namespace behaves the same as using VirtualPath.

, - , - .

, ?

UPDATE:

!

, . , .

+5
3

!

, . , .

0

masterpage. -.

namespace TestNS
{
    public partial class TestMP : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}

, - :

http://msdn.microsoft.com/en-us/library/aa730880(VS.80).aspx

+1

<%@ MasterType VirtualPath="~/Mastername.master" %>

<%@ MasterType TypeName="Mastername" %>

0
source

All Articles