HttpClientHandler.AutomaticDecompression Property

Definition

Gets or sets the type of decompression method used by the handler for automatic decompression of the HTTP content response.

C#
public System.Net.DecompressionMethods AutomaticDecompression { get; set; }
C#
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public System.Net.DecompressionMethods AutomaticDecompression { get; set; }

Property Value

The automatic decompression method used by the handler.

Attributes

Remarks

Automatic decompression works only on the top most compression. So if the content is compressed multiple times, only the last compression will be decompressed. For example, for a response with Content-Encoding: gzip, br header that contains content first compressed with gzip and then with Brotli, the content will only be decompressed using Brotli, leaving the still gzipped content in the Content.

Setting automatic decompression to anything other than None will result in adding Accept-Encoding header with the set values into every outgoing HttpRequestMessage.

For the .NET Framework 4.x System.Net.Http binary in the Global Assembly Cache (GAC), the default value is None.

When the System.Net.Http NuGet package v4.1.0 to v4.3.2 is used, the default is GZip and Deflate.

After NuGet package v4.3.2, the default value of None is used.

Applies to

Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0