UrlCompressionSection Class

Enables or disables dynamic or static compression.

Syntax

class UrlCompressionSection : ConfigurationSection  

Methods

The following table lists the methods exposed by the UrlCompressionSection class.

Name Description
GetAllowDefinition (Inherited from ConfigurationSection.)
GetAllowLocation (Inherited from ConfigurationSection.)
RevertToParent (Inherited from ConfigurationSection.)
SetAllowDefinition (Inherited from ConfigurationSection.)
SetAllowLocation (Inherited from ConfigurationSection.)

Properties

The following table lists the properties exposed by the UrlCompressionSection class.

Name Description
DoDynamicCompression A read/write boolean value. true if dynamic compression is enabled for URLs; otherwise, false. The default is false. Note: Use of dynamic compression may increase processor utilization and reduce the overall performance of the Web server.
DoStaticCompression A read/write boolean value. true if static compression is enabled for URLs; otherwise, false. The default is true.
DynamicCompressionBeforeCache A read/write boolean value. true if the currently available response is dynamically compressed before it is put into the output cache; otherwise, false. The default is false. For more information, see the Remarks section.
Location (Inherited from ConfigurationSection.) A key property.
Path (Inherited from ConfigurationSection.) A key property.
SectionInformation (Inherited from ConfigurationSection.)

Subclasses

This class contains no subclasses.

Remarks

When the DynamicCompressionBeforeCache property is true, IIS dynamically compresses the response the first time a request is made. The compressed response is put into the output cache, and the cached response is sent to the client. Subsequent requests are served from the compressed response in the output cache.

When DynamicCompressionBeforeCache is false, IIS puts the noncompressed response into the output cache. Then, every time that the response is requested, IIS dynamically compresses the cached response as it is sent to the client.

If you set the DynamicCompressionBeforeCache property to true, the CPU will dynamically compress the response only once instead of every time the page is requested. Because dynamic compression is CPU-intensive, a setting of true can reduce the server load and improve site throughput.

Note

If the DynamicCompressionBeforeCache property is true when the output cache response has been flushed, dynamic compression will not be performed before the response is put into the output cache. However, if the DoDynamicCompression property is true, dynamic compression will still occur after the response has been put into the output cache.

Example

The following example lists the dynamic and static compression settings for all paths and locations on a Web server. An empty Location property in the output indicates that the setting is global.

' Connect to the WMI WebAdministration namespace.  
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")  
  
' Get the URL compression section.  
Set oUrlCompressionSection = oWebAdmin.ExecQuery( _  
    "SELECT * FROM UrlCompressionSection")  
  
' List the dynamic and static compression settings for each location.  
For Each vUrlCompressionProperty In oUrlCompressionSection  
    WScript.Echo "Location: " & vUrlCompressionProperty.Location  
    WScript.Echo "DoDynamicCompression: " & _  
        vUrlCompressionProperty.DoDynamicCompression  
    WScript.Echo "DoStaticCompression: " & _  
        vUrlCompressionProperty.DoStaticCompression  
    WScript.Echo  
Next  

Inheritance Hierarchy

ConfigurationSection

UrlCompressionSection

Requirements

Type Description
Client - IIS 7.0 on Windows Vista
- IIS 7.5 on Windows 7
- IIS 8.0 on Windows 8
- IIS 10.0 on Windows 10
Server - IIS 7.0 on Windows Server 2008
- IIS 7.5 on Windows Server 2008 R2
- IIS 8.0 on Windows Server 2012
- IIS 8.5 on Windows Server 2012 R2
- IIS 10.0 on Windows Server 2016
Product - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0
MOF file WebAdministration.mof

See Also

ConfigurationSection Class
HttpCompressionSection Class