I had this issue, as I had copied a (fairly generic) webpage from one of my ASP.Net applications into a new application.
I changed the relevant namespace commands, to reflect the new location of the file... but... I had forgotten to change the Inherits parameter in the aspx page itself.
<%@ Page MasterPageFile="" StylesheetTheme="" Language="C#"
AutoEventWireup="true" CodeBehind="MikesReports.aspx.cs"
Inherits="MikesCompany.MikesProject.MikesReports" %>
Once I had changed the Inherits parameter, the error went away.