逃避HTML文本 [英] Escape text for HTML
本文介绍了逃避HTML文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何逃脱在C#中使用HTML文本?我想要做的。
样品=<跨度>等等<跨度>中
和有
<跨度>等等<跨度>
显示为纯文本,而不是仅嗒嗒的HTML :(的标签部分。
使用C#不ASP
解决方案
使用的System.Web;变种EN codeD = HttpUtility.HtmlEn code(unen codeD);
How do i escape text for html use in C#? I want to do
sample="<span>blah<span>"
and have
<span>blah<span>
show up as plain text instead of blah only with the tags part of the html :(. Using C# not ASP
解决方案
using System.Web;
var encoded = HttpUtility.HtmlEncode(unencoded);
这篇关于逃避HTML文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文