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.
这是ToString()造成问题的原因。Html.Raw返回一个特殊的HtmlString告诉 Razor 它不需要编码,但随后您将其直接转回确实已编码的常规字符串。只需使用:
ToString()
Html.Raw
HtmlString
@Html.Raw("</div><div class=\"newDiv\">")