我正在使用母版页创建一个网站,工作正常。但是在我将实体数据模型和一些检索代码添加到登录页面后,它出现了一些错误
代码就像
var tombstoneQuery = from t in crnnsupContext.Tombstones.Include("ProvState")
where t.RegNumber == _username
select t;
List<Tombstone> tombstoneResult = tombstoneQuery.ToList();
Cache.Insert("Tombstone", tombstoneResult);
第一个错误发生在我尝试将列表放入缓存时,错误显示“线程正在中止。在我设置cache.insert语句作为推荐之后,此错误消失了,但下一个错误< / p>
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">
续订是主页,我没有对它做任何事情。 谁有人可以帮忙?非常感谢
续订页面的代码。 (注意到那里)
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" %>
答案 0 :(得分:4)
这告诉您OnlineRenewal.Renewal
不是母版页。
确保页面顶部有一个<%@ Master %>
指令,或者将导致此错误的页面的inherits属性更改为其他内容。