pita pita - 3 months ago 14
ASP.NET (C#) Question

page is not allowed here because it does not extend class 'System.Web.UI.MasterPage'

I am creating a website using master page, which works fine. but after I add entity data model and some retrieval code into the login page, it comes some errors

the code is like

var tombstoneQuery = from t in crnnsupContext.Tombstones.Include("ProvState")
where t.RegNumber == _username
select t;
List<Tombstone> tombstoneResult = tombstoneQuery.ToList();
Cache.Insert("Tombstone", tombstoneResult);


the first error is happened when i try to put the list into the Cache, the error says "Thread was being aborted. After I set cache.insert statement as a commend, this error was gone, but the next one came

Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: 'OnlineRenewal.Renewal' is not allowed here because it does not extend class 'System.Web.UI.MasterPage'.

Source Error:


Line 1: <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="renewal.Master.cs" Inherits="OnlineRenewal.Renewal" %>
Line 2:
Line 3: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


the Renewal is the master page which i didn't do anything with it.
anyone can help? thanks a lot

the code for renewal page. (there is noting there)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;


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

}
}
}




<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="renewal.Master.cs" Inherits="OnlineRenewal.Renewal" %>

Answer

This is telling you that OnlineRenewal.Renewal is not a master page.

Ensure it has a <%@ Master %> directive at the top of the page, or change the inherits attribute of the page that is causing this error to something else.