Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在从服务运行 Postal。我的@Message 有html。@Html.Raw 不可用。当 Postal 运行我的模板化视图时,我得到了 HtmlEncoded html。有谁知道如何解决这一问题?
在我们的服务中,我们使用了:
@Raw(StringToBeEncoded)
在 html 模板中它会抱怨它无法解决,但在运行时 @Raw 工作正常。它是 RazorEngine 的一部分。
您可以使用:
@(new System.Web.HtmlString(StringToBeEncoded))
HtmlHelper.Raw(StringToBeEncoded)这与引擎盖下的方法基本相同。此外,您不会在 Visual Studio 中为模板收到任何错误。
HtmlHelper.Raw(StringToBeEncoded)