开发者

Why Spark viewengine renders unnecessary (or unexpected) quotes?

开发者 https://www.devze.com 2022-12-15 01:21 出处:网络
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.

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)=>

Why Spark viewengine renders unnecessary (or unexpected) quotes?

This is how it looks when base type is specified=>

Why Spark viewengine renders unnecessary (or unexpected) quotes?

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...
&lt;a href=&quot;/Employee/Create&quot;&gt;Create&lt;/a&gt;           
            </div> 
        </div> 
    </div> 
</body> 

Developer tools does not=>

Why Spark viewengine renders unnecessary (or unexpected) quotes?

So - why my link gets htmlencoded (if that's what happens)? If it's default behavior, then how to render raw html?


Using latest Sp开发者_高级运维ark version, rebuilt with Asp.Net Mvc2 RC assemblies.


is automaticEncoding set to true in the web.config?

<spark>
  <pages automaticEncoding="false">
  </pages>
</spark>


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消