c# - 如何在 C# 字符串中显示 HTML 内容?

标签 c# html asp.net

我正在努力实现这样的目标:

string html = @"Hello <b> World ! </b>";

期望的输出是

Hello World !

字符串 html 可以在标签、文本框等任何地方使用。

但它不起作用。它只是按原样显示 Hello <b> World ! </b>

还有其他方法吗?

最佳答案

像这样尝试 HtmlString:

HtmlString html = new HtmlString("Hello <b> World ! </b>");

关于c# - 如何在 C# 字符串中显示 HTML 内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22344490/

相关文章:

c# - 如何为 Twitter 更新编码变音符号?

c# - 显示最近 7 天的行

html - 响应式背景图像 - 逐渐调整大小/重新缩放

html - 显示部分/div 取决于链接中散列# 值之后

c# - DropDownList如何设置DataSource

c# - 如何检查一个字段是否是图像字段

c# - visual studio中的 "File has no header"构建警告是什么意思

html - 如何将背景样式覆盖回原始样式?

c# - 模型值在回发期间丢失

asp.net - Application Insights 扩展破坏了 Azure Web 应用程序