Failed to load type 'newVersion_Default'

When I try to create the Default.aspx page, I get an error:

Error 5 Failed to load type 'NewVersion_Default. \ Server1 \ d $ \ newVersion \ Default.aspx

Content Page:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="newVersion_Default" MasterPageFile="Main.master" %>
<%@ MasterType VirtualPath="Main.master" %>

<asp:Content id="Content2" contentplaceholderid="mainContent" runat="server"> 

    <h1>Welcome to this Page</h1>

    <div class="tabWrapper">
        <div class="tab"><a href="#">Home</a></div>
        <div class="tab"><a href="#">Tab 2</a></div>
        <div class="tab tabSelected"><a href="#">Something Els wef wef w efe</a></div>
        <div class="tab"><a href="#">Help!</a></div>
        <div class="clear"></div>
    </div>                
</asp:Content>

And the code behind is empty!

public partial class newVersion_Default : System.Web.UI.Page
{
}

This is probably a beginners mistake, but any help was appreciated :)

I can’t rebuild the whole project, because in folders that are classic ASPs that don’t build and post errors, I can’t rebuild the whole project, so I have to create each page at a time, will this cause problems?

+3
source share
1 answer

In the case of a web application:

Try using a namespace:

Inherits="MySite.newVersion_Default"

namespace MySite
{
    public partial class newVersion_Default : System.Web.UI.Page { }
}

In the case of a website:

Use CodeFileinsteadCodeBehind

+2

Source: https://habr.com/ru/post/1787690/


All Articles