gpt4 book ai didi

c# - 我们应该对 HtmlString 使用编码吗?

转载 作者:太空狗 更新时间:2023-10-30 00:27:58 27 4
gpt4 key购买 nike

ASP.NET MVC 的优势

<%= Html.LabelForModel() %>

<%: Html.LabelForModel() %>

?为什么?

最佳答案

如果它返回 MvcHtmlString 则无所谓; <%:会知道它是预转义的。因此,我会使用 <%:这样审稿人就不需要考虑“这是转义了吗?还是原始字段?”。

当然,这取决于创建 MvcHtmlString 的代码是否正常......

关于c# - 我们应该对 HtmlString 使用编码吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4462588/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com