首页 > 解决方案 > 如何从 asp.net 核心指定请求编码、响应编码?

问题描述

如何从 asp.net 核心指定请求编码、响应编码?

在 Web.config 中指定了 asp.net 项目。

<globalization requestEncoding="euc-kr" responseEncoding="euc-kr"   />

和回应

HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/html; charset=euc-kr
Server: Microsoft-IIS/10.0
X-AspNetMvc-Version: 5.2
X-AspNet-Version: 4.0.30319 
X-Powered-By: ASP.NET
Date: Wed, 14 Jul 2021 01:50:12 GMT
Content-Length: 229


从 asp.net core 项目返回的响应

HTTP/1.1 200 OK
Transfer-Encoding: chunked
Content-Type: text/html; charset=utf-8
Content-Encoding: gzip
Vary: Accept-Encoding
Server: Microsoft-IIS/10.0
X-Powered-By: ASP.NET
Date: Wed, 14 Jul 2021 01:53:46 GMT

如何更改全球化编码类型?

标签: c#asp.netasp.net-core

解决方案


推荐阅读