【发布时间】:2014-09-25 20:56:44
【问题描述】:
我的网站出现以下错误:
内容控件仅允许在引用 母版页。
这是它尝试加载的文件的内容:
<%@ Page Language="c#" MasterPageFile="~/shared/templates/Default.master" %>
<asp:Content ID="PageContent" runat="server" ContentPlaceHolderID="PageContentPlaceHolder" />
Default.master 确实存在于请求的位置并且确实包含:
<asp:ContentPlaceHolder runat="Server" ID="PageContentPlaceHolder" />
为什么子页面无法识别/加载母版页?
谢谢!
更新 - 这是堆栈跟踪和 .NET 版本信息:
[HttpException (0x80004005): Content controls are allowed only in content page that references a master page.]
System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection) +11119902
System.Web.UI.Page.get_Master() +69
System.Web.UI.Page.ApplyMasterPage() +18
System.Web.UI.Page.PerformPreInit() +58
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1256
版本信息:Microsoft .NET Framework 版本:2.0.50727.5485; ASP.NET 版本:2.0.50727.5483
【问题讨论】:
-
您确定是哪一行/文件引发了错误吗?您确定服务器上的文件与您正在查看的文件相符吗?
-
没有得到行号,我直接在服务器上编辑文件。
-
母版页是否有
标签: asp.net master-pages