Microsoft KB Archive/304279

From BetaArchive Wiki
Knowledge Base


How To Enable Compression and Decompression of Data By Using XMLHTTP Code

Article ID: 304279

Article Last Modified on 7/1/2004



APPLIES TO

  • Microsoft XML Core Services 4.0, when used with:
    • Microsoft Windows 2000 Standard Edition
  • Microsoft XML Parser 3.0 Service Pack 1, when used with:
    • Microsoft Windows 2000 Standard Edition
  • Microsoft XML Core Services 4.0, when used with:
    • Microsoft Windows 2000 Standard Edition



This article was previously published under Q304279

SUMMARY

Data that is returned to a browser can be compressed and decompressed by using XMLHTTP. HTTP compression allows Internet Information Services (IIS) to send compressed content to a client, and URLMON is responsible for the decompression on the client side.

MORE INFORMATION

A client computer can use the XMLHTTP object (MSXML2.XMLHTTP) to send an arbitrary HTTP request or data to a Web server and receive a response. More specifically, an XMLHTTP POST uses HTTP to send data and a response request to a Web server's Active Server Pages (ASP) page. An XMLHTTP GET just requests a response. The response is written to the browser's output by setting the ContentType and passing the response to the Response object.

The following article contains sample code in which the client uses the XMLHTTP POST command to send data and request a response from an ASP page:

290591 How To Submit Form Data by Using XMLHTTP or ServerXMLHTTP Object


Although IIS may store a compressed copy of the file in a temporary folder if static data is being retrieved, the data in the XMLHTTP POST scenario is dynamic and no copy of the file is stored. IIS 5.0 compresses the file as it is generated and sends the compressed file to the browser. For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

255801 How to Determine if HTTP Compression Is in Use


To enable HTTP compression on GET or POST requests, the IIS settings for HTTP compression should be set by using the Service tab of the WWW Service Master Properties. For more information on how to do this, see the IIS documentation. A fix has been developed to enable HTTP compression on POST requests and was first included in Windows 2000 Service Pack 2. This fix should be applied to the server with the receiver ASP. For more information on the fix, see the following Knowledge Base article:

259760 Compression Is Not Enabled on POST Request


Alternatively, ServerXMLHTTP provides methods and properties for server-safe HTTP access between different Web servers. ServerXMLHTTP relies on WinHTTP. Currently, WinHTTP 4.0 and later does not support decompression; therefore, ServerXMLHTTP code may not be used to engage compression and decompression of files.

REFERENCES

255951 HTTP Compression Methods and Files Used by IIS 5.0


290761 Frequently Asked Questions about ServerXMLHTTP


Keywords: kbhowto KB304279