For me I had all of the namespaces on the pages and none of the solutions above fixed it. My problem was in:
<%@ Page Language="C#"
AutoEventWireup="true"
CodeBehind="xxx.aspx.cs"
Inherits="xxx.xxx.xxx"
MasterPageFile="~masterurl/default.master" %>
Then in my aspx.cs
file the namespace did not match the Inherits
tag. So it needed
namespace xxx.xxx.xxx
In the .cs
to match the Inherits
.