This is a migrated thread and some comments may be shown as answers.

GZIP compression

0 Answers 299 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Zÿm
Top achievements
Rank 1
Zÿm asked on 14 Mar 2012, 08:36 AM
protected void Application_PostReleaseRequestState(object sender, EventArgs e)
    {
        string contentType = Response.ContentType;
 
        if (contentType == "text/html" || contentType == "text/css" || contentType == "application/x-javascript" || contentType == "application/json")
        {
            Response.Cache.VaryByHeaders["Accept-Encoding"] = true;
            string acceptEncoding = Request.Headers["Accept-Encoding"];
 
            if (acceptEncoding != null)
            {
                if (acceptEncoding.Contains("gzip"))
                {
                    Response.Filter = new GZipStream(Response.Filter, CompressionMode.Compress);
                    Response.AppendHeader("Content-Encoding", "gzip");
                }
                else if (acceptEncoding.Contains("deflate"))
                {
                    Response.Filter = new DeflateStream(Response.Filter, CompressionMode.Compress);
                    Response.AppendHeader("Content-Encoding", "deflate");
                }
            }
        }
    }

I got this code in global.asax, i want gzip enabled, but not on iis level, but after this, radDateTimePicker is broken.
it still "works" but it has no style, pick button is repeated in strange way, and the title of hyperlink is shown instead of image button; Am i doing something wrong?

No answers yet. Maybe you can help?

Tags
General Discussions
Asked by
Zÿm
Top achievements
Rank 1
Share this question
or