gpt4 book ai didi

asp.net-mvc - 将 "charset"添加到所有 ASP.NET MVC HTTP 响应

转载 作者:行者123 更新时间:2023-12-01 23:30:38 25 4
gpt4 key购买 nike

是否有一种简单的方法来指定 ASP.NET MVC 应用程序的所有“正常” View ,将 charset=utf-8 附加到 Content-TypeView() 缺少允许您指定 Content-Type 的覆盖,并且 ActionResult 和 friend 似乎也没有公开任何内容。动机显然是为了解决 Internet Explorer 猜测“正确”编码类型的问题,而我又想这样做以避免 UTF-7 XSS 攻击。

最佳答案

也许你的 web.config 中的这个会起作用?

<configuration>
<system.web>
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />
</system.web>
</configuration>

关于asp.net-mvc - 将 "charset"添加到所有 ASP.NET MVC HTTP 响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1743961/

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