母版页错误
我正在使用 VS2010 Beta 2 创建一个全新的母版页,我收到此警告(这导致我在内容页面中出现错误):
验证(XHTML 1.0 过渡): 外部不支持内容 “script”或“asp:content”区域。
母版页的代码:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Bob.master.cs" Inherits="TShirtFactory.Web.All.Core.lib.masterpage.Bob" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
如您所见,它是默认母版页生成的代码。当我将标签悬停在顶部时,我收到警告。有人知道发生了什么事吗?
谢谢
i'm creating a brand new masterpage with VS2010 Beta 2 and I get this warning (that causes me errors in the content pages):
Validation (XHTML 1.0 Transitional):
Content is not supported outside
'script' or 'asp:content' regions.
The masterpage's code :
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Bob.master.cs" Inherits="TShirtFactory.Web.All.Core.lib.masterpage.Bob" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
As you can see, it's the default masterpage generated code. I get the warning when I hover the tag at top. Does anybody have an idea of what's going on ?
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
就我而言,从 web.config 文件的页面部分中删除 masterPageFile 属性后,错误就消失了:
或者,如果您在 web.config 文件中需要此属性,只需将空的 MasterPageFile 添加到母版页即可:
In my case the error has gone after removing masterPageFile attribute from the Page-section in the web.config file:
Or, if you need this attribute in the web.config file, just add empty MasterPageFile to you master page:
很简单... Visual Studio 太疯狂了。事实上,事实是它不可能仅仅因为其中大部分是动态的而验证某些标记。例如,在我的项目中,我不断收到关于缺少
It's simple... Visual Studio is bonkers. Actually, the truth is that it can't possibly validate some markup simply because much of it is dynamic. For instance, in my project I have a constant warning about the lack of a <title> tag because it's added dynamically. Bottom line: the XHTML validator does not really know much about ASP.NET code.