Compression Property  
 

Set or return if data compression should be enabled.

Syntax

object.Compression [= { True | False } ]

Remarks

The Compression property is used to indicate to the server whether or not it is acceptable to compress the data that is returned to the client. If compression is enabled, the client will advertise that it will accept compressed data by setting the Accept-Encoding request header. The server will decide whether a resource being requested can be compressed. If the data is compressed, the control will automatically expand the data before returning it to the caller.

Enabling compression does not guarantee that the data returned by the server will actually be compressed, it only informs the server that the client is willing to accept compressed data. Whether or not a particular resource is compressed depends on the server configuration, and the server may decide to only compress certain types of resources, such as text files. Disabling compression informs the server that the client is not willing to accept compressed data; this is the default.

If the SetHeader method is used to explicitly set the Accept-Encoding header to request compressed data and compression is not enabled, the control will not attempt to automatically expand the data returned by the server. In this case, the raw compressed data will be returned and the application is responsible for processing it. This behavior is by design to maintain backwards compatibility with previous versions of the control that did not have internal support for compression.

To determine if the server compressed the data returned to the client, use the GetHeader method to get the value of the Content-Encoding header. If the header is defined, the value specifies the compression method used, otherwise the data was not compressed.

This property value is only meaningful when downloading files from a server that supports file compression. It has no effect on file uploads.

Data Type

Boolean

See Also

GetData Method, GetFile Method, GetHeader Method SetHeader Method