When using response compression in c#, will later use of IIS compression cause problems?
I am using a webservice as the endpoint for an XHR request, and planning on gzip/deflate compressing the response for compatible browsers.
I am using code based on http://www.dominicpettifer.co.uk/Blog/17/gzip-compress-your-websites-html-css-script-in-code :
string acceptEncoding =
context.Request.Headers["Accept-Encoding"];
if (acceptEncoding.Contains("gzip"))
{
context.Response.Filter = new GZipStream(
context.Response.Filter, CompressionMode.Compress);
context.Response.AppendHeader(
"Content-Encoding", "gzip");
}
else if (acceptEncoding.Contains("deflate"))
{
con开发者_如何学运维text.Response.Filter = new DeflateStream(
context.Response.Filter, CompressionMode.Compress);
context.Response.AppendHeader(
"Content-Encoding", "deflate");
}
context.Response.Write(response);
It is possible that at some later date IIS compression may be turned on. Would this break the response?
精彩评论