Click here to Skip to main content
15,920,687 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
what is gzip compression and how to helps to get xml response from server faster ..

also what is benefit of using gzip

also code example to use gzip to get xml response from server in asp.net
Posted

 
Share this answer
 
gzip used for file compression and decompression.

try this

public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "application/x-gzip";
var xml = "<xml/>";
using (var gzipStream = new GZipStream(context.Response.OutputStream, CompressionMode.Compress))
{
var buffer = Encoding.UTF8.GetBytes(xml);
gzipStream.Write(buffer, 0, buffer.Length);
}
}
 
Share this answer
 
Comments
maulikshah1990 5-Mar-14 3:05am    
what is to be used (reference ) , to use GzipStream..
also how to compress js and css files
Mehul Thummar 5-Mar-14 4:15am    
GzipStream class Provides methods and properties used to compress and decompress streams.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900