HTML编码字符串 - ASP.NET Web窗体VS的Razor视图引擎 [英] HTML Encoding Strings - ASP.NET Web Forms VS Razor View Engine
本文介绍了HTML编码字符串 - ASP.NET Web窗体VS的Razor视图引擎的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不太清楚这是如何工作又试着找文档。
在我现有的应用程序,我有我的视图渲染字符串的两种不同方式。
<%:model.something%GT;
<! - 或 - >
&所述;%= model.something%GT;
第一个是HTML烯$ C $光盘,而第二个是不
有东西在剃刀类似的短?所有我能找到的就是这个,这是EN codeD版本。
@ model.something
解决方案
我想最好的办法是使用Raw扩展法: @ Html.Raw(Model.Something)
I'm not quite sure how this works yet... trying to find documentation.
In my existing app I've got two different ways of rendering strings in my View
<%: model.something %>
<!-- or -->
<%= model.something %>
The first one is html encoded, and the second one is not.
Is there something similarly short in Razor? All I can find is this, which is the encoded version.
@model.something
解决方案
I guess the best approach would be to use the Raw extension-method: @Html.Raw(Model.Something)
这篇关于HTML编码字符串 - ASP.NET Web窗体VS的Razor视图引擎的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文