ContentLengthXL Property  
 

Return the content length for the current resource.

Syntax

object.ContentLengthXL

Remarks

Remarks

The ContentLengthXL property is a read-only value that returns the size of the current resource which has been retrieved from the server. When this property value is checked after a GET or POST request has completed, the value will be the total number of bytes returned by the server. If this property is checked while a request is being processed (for example, from within an event handler), it will return the value of the Content-Length response header provided by the server. This property returns the number of bytes as a Double floating-point value instead of a Long integer, making it suitable for very large files that exceed 2 GiB in size.

Most servers will only include a Content-Length header in the response for static resources like documents or image files. For other types of resources where the response payload is generated dynamically, such as server-side scripts, servers typically use "chunked" output and there is no Content-Length header.  The server may also not provide a file size for HTML documents which use server side includes (SSI) because that content is also dynamically created by the server. In this case, the content length can only be determined after the request has completed.

This property value should only be checked after a request has completed and will not return a value for dynamic resources as they are being retrieved from the server. To obtain the current number of bytes copied from within an event handler, check the value of the TransferBytesXL property.

If the content type for the current resource is textual, the content length reported by the server may be different than what is stored on the local system due to different end-of-line character conventions. For example, on Windows the end of a line of text is indicated by a carriage-return and linefeed pair, while on Linux the end-of-line is indicated by a single linefeed. Depending on the options specified when the request is made, text returned by the server may be normalized for the Windows platform.

This property does not use the HEAD command to request the size of a document on the server. It will only return the content length of a resource which has already been requested, typically after using methods such as GetText or PostXml. To ask the server for the size of document without downloading the contents of that document, use the GetFileSize method.

Data Type

Double

See Also

ContentLength Property, ContentType Property, TransferBytesXL Property, GetFileSize Method, GetHeader Method, SetHeader Method