I'm not even sure that
Headers.ContentEncoding
is a standard header. There is a
Content-Encoding
header but that is related to compression (eg gzip, deflate).
It looks like you may have a problem with
Response.Charset = encoding.EncodingName;
, which would give out the "friendly name" as opposed to the IANA registry name. Try replacing the
encoding.EncodingName with
encoding.WebName, and getting rid of the other header.
Reference:
Encoding.WebName Property (System.Text) | Microsoft Docs[
^]