为什么 Spark viewengine 会呈现不必要的(或意外的)引号?
如果我在 web.config 中添加 pageBaseType="Spark.Web.Mvc.SparkView" (修复智能感知所必需的),不知何故,它不再正确渲染链接(可能不仅如此)。
这就是它应该的样子(如果未指定页面基本类型,则确实如此)=>
这是指定基本类型时的样子=>
Chrome 源查看器在两种情况下显示相同的页面源代码=>
<body>
<div class="content">
<div class="navigation">
<a href="/Employee/List">Employees</a>
<a href="/Product/List">Products</a>
<a href="/Store/List">Stores</a>
<div class="navigation_title">
Navigation</div>
</div>
<div class="main">
<div class="content">
<h2>Employees</h2>Nothing found...
<a href="/Employee/Create">Create</a>
</div>
</div>
</div>
</body>
开发者工具没有=>
那么 - 为什么我的链接会被 htmlencoded(如果发生这种情况)?如果这是默认行为,那么如何渲染原始 html?
使用最新的 Spark 版本,使用 Asp.Net Mvc2 RC 程序集重建。
If i add pageBaseType="Spark.Web.Mvc.SparkView"
in my web.config (necessary to fix intellisense), somehow it does not render links (probably not only) correctly anymore.
This is how it's supposed to look like (and does, if page base type is not specified)=>
This is how it looks when base type is specified=>
Chrome source viewer shows identical page source code for both cases=>
<body>
<div class="content">
<div class="navigation">
<a href="/Employee/List">Employees</a>
<a href="/Product/List">Products</a>
<a href="/Store/List">Stores</a>
<div class="navigation_title">
Navigation</div>
</div>
<div class="main">
<div class="content">
<h2>Employees</h2>Nothing found...
<a href="/Employee/Create">Create</a>
</div>
</div>
</div>
</body>
Developer tools does not=>
So - why my link gets htmlencoded (if that's what happens)? If it's default behavior, then how to render raw html?
Using latest Spark version, rebuilt with Asp.Net Mvc2 RC assemblies.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
web.config 中的automaticEncoding 设置为true 吗?
is automaticEncoding set to true in the web.config?
你这里有两个不同的问题。
首先是编码问题。
其次是引号,这些都是 Chrome 的。
Chrome 已将您的文本和链接包含在 CDATA 节点内。您的页面的某些内容触发了它呈现 XHTML,因此它不允许该文本出现在 DIV 中。通常,HTML 元素上的 XHTML 命名空间会执行此操作,或者您的应用程序正在发送具有 XHTML MIME 类型的页面。但我发现在 Chrome 中进行测试时,页面的其他内容会将其踢入 XHTML 模式,例如自结束标签等。
You have 2 different problems here.
First the encoding issue.
Second the Quotes, those are ALL Chrome.
Chrome has enclosed your text and link inside a CDATA node. Something about your page has triggered it to render XHTML and as such it won't allow that text inside a DIV. Usually the XHTML namespace on the HTML element does it or your app is sending pages with the XHTML MIME type. But I have found testing in Chrome that other things about a page will kick it into XHTML mode like self ending tags and the like.