Engine.CalculateContentLength Property

IT Hit WebDAV for .NET

Indicates if response content length calculation will occur.

[Visual Basic]
Public Property CalculateContentLength As Boolean
[C#]
public bool CalculateContentLength {get; set;}

Property Value

Boolean value indicating if content length will be calculated in Run method. Default is true.

Remarks

If this property is set to true engine will calculate output content length and set ContentLength property before returning from Run method. If you would like to send chunked responses you must set this property to false.

ASP.NET will send chunked responses only to GET verb if HttpContext.Current.Response.BufferOutput = false and request is HTTP 1.1. Responses to all other verbs will not be chunked.

To send chunked responses from HttpListener you must set this property to false and set HttpListenerContext.Response.SendChunked = true. If SendChunked=false and CalculateContentLength=false than HttpListener will not send any response because the content length will be unknown.

Responses must not include both Content-Length header and Transfer-Encoding: chunked header. If server is sending chunked response client application will not be able to detect content length. Downloading a large file using download manager client will not be able to see the entire content length and evaluate time required for download.

See Also

Engine Class | ITHit.WebDAV.Server Namespace