Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 743053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:49:07+00:00 2026-05-14T08:49:07+00:00

Can I simply set the Transfer-Encoding header? Will calling Response.Flush() at some point cause

  • 0

Can I simply set the Transfer-Encoding header?

Will calling Response.Flush() at some point cause this to occur implicitly?


EDIT
No, I Cannot call Response.Headers.Add("Transfer-Encoding","anything"); That throws.

any other suggestions?


Related:
Enable Chunked Transfer Encoding in ASP.NET

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T08:49:08+00:00Added an answer on May 14, 2026 at 8:49 am

    TL;DR: Specifying the content-length is the best way to achieve a fast first byte; you’ll allow chunking at TCP rather than HTTP level. If you don’t know the content-length, setting context.Response.BufferOutput to false will send output as it’s written the the output stream using chunked transfer-encoding.


    Why do you want to set Transfer-Encoding: chunked? Chunked transfers are essentially a work-around to permit sending documents whose content-length is not known in advance. ASP.NET, however, by default buffers the entire output and hence does know the overall content length.

    Of course, HTTP is layered over TCP, and behind the scene TCP is “chunking” anyhow by splitting even a monolithic HTTP response into packets – meaning that if you specify the content-length up front and disable output buffering, you’ll get the best latency without requiring HTTP-level chunking. Thus, you don’t need HTTP-level chunking to provide a fast first byte when you know the content-length.

    Although I’m not an expert on HTTP, I have implemented a simple streaming media server with seeking support, dynamic compression, caching etc. and I do have a reasonable grasp of the relevance of a fast first byte – and chunking is generally an inferior option if you know the content-length – which is almost certainly why ASP.NET won’t let you set it manually – it’s just not necessary.

    However, if you don’t know the HTTP content length before transmission and buffering is too expensive, you turn off output buffering and presumably the server will use a chunked transfer encoding by necessity.

    When does the server use chunked transfer encoding? I just tested, and indeed if context.Response.BufferOutput is set to false, and when the content length is not set, the response is chunked; such a response is 1-2% larger in my entirely non-scientific quick test of a 1.7MB content-encoding: gzip xml document. Since gzip relies on context to reduce redundancy, I’d expected the compression ratio to suffer more, but it seems that chunking doesn’t necessarily greatly reduce compression ratios.

    If you look at the framework code in reflector, it seems that the transfer encoding is indeed set automatically as needed – i.e. if buffering is off AND no content length is known AND the response is to an HTTP/1.1 request, chunked transfer encoding is used. However, if the server is IIS7 and this is a worker request (?integrated mode?), the code branches to a native method – probably with the same behavior, but I can’t verify that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 429k
  • Answers 429k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Alright, i've done it so im posting it here to… May 15, 2026 at 1:33 pm
  • Editorial Team
    Editorial Team added an answer Assuming OpenGL 2.1, use a buffer object of type GL_PIXEL_UNPACK_BUFFER… May 15, 2026 at 1:33 pm
  • Editorial Team
    Editorial Team added an answer First, off, the 2nd branch appears to be nothing but… May 15, 2026 at 1:32 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.