Wednesday, October 15, 2008

Page does not contain a definition for 'Context'

I inherited a website this week and it wouln't build. In the past the website was built in debug mode and the files were moved out manually. It wouldn't built in release mode and it wouldn't allow for me to do a publish website. It received the error ... "does not contain a definition for context."

The web page had the following page definition:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MyPage1.aspx.cs" Inherits="MyPage1" %>

Whereas, the codebehind for MyPage1 (MyPage1.aspx.cs) included the wrong class name. I updated the class name to correspond to the class name mentioned in the web page and it will now build in release mode.

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class MyPage2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
}

No comments: