Missed Content-Length header in response

Former Member
Former Member

Hi

I had to send to user a xml-data (don't confuse with "text/html" mime), but in browser I see, that Content-Length header is missing.

I googled several hours and found several solutions but all of them does not work.



context.Response.Clear();
context.Response.StatusCode = 200;
context.Response.ContentType = "text/html";
context.Response.Output.Write(body);
context.Response.Flush();
context.Response.SuppressContent = true;
context.ApplicationInstance.CompleteRequest();


Also I already tried to manualy add "Content-Lenght" header with body.Length but on result it disappear!

My response headers from brouser:

Cache-Control: private
Content-Encoding: gzip
Content-Language: en-US
Content-Security-Policy: frame-ancestors 'self';
Content-Type: text/html; charset=utf-8
Date: Wed, 22 Apr 2020 10:11:24 GMT
Keep-Alive: timeout=15, max=97
Last-Modified: Tue, 21 Apr 2020 08:24:00 GMT
Server: Microsoft-IIS/10.0
Transfer-Encoding: chunked
Vary: User-Agent,Accept-Encoding
X-Content-Type-Options: nosniff
X-FRAME-OPTIONS: SAMEORIGIN
X-Powered-By: ASP.NET
X-Telligent-Evolution: 10.x
X-UA-Compatible: IE=Edge
X-XSS-Protection: 1; mode=block


I think part of the problem is in "Transfer-Encoding: chunked"

Can anyone help me?



format
[edited by: Iurii Luzan at 10:41 AM (GMT 0) on Wed, Apr 22 2020]