Showing posts with label Gzip. Show all posts
Showing posts with label Gzip. Show all posts

Wednesday, July 18, 2012

How to set gzip/deflate compression in .net.

To enable Gzip and deflate compression in Asp.net website, you just need to place this code in global.asax.
however you can also apply this setting to IIS level.

void Application_PreRequestHandlerExecute(object sender, EventArgs e)
    {
      
        try
        {
            HttpResponse Response = HttpContext.Current.Response;
            String AcceptEncoding = HttpContext.Current.Request.Headers["Accept-Encoding"];