Exemplo n.º 1
0
 private void context_EndRequest(object sender, EventArgs e)
 {
     if (CompressionModule.IsBrowserSupported() && (CompressionModule.IsEncodingAccepted("deflate") || CompressionModule.IsEncodingAccepted("gzip")))
     {
         HttpApplication httpApplication = (HttpApplication)sender;
         string          text            = httpApplication.Request.QueryString.ToString();
         if (httpApplication.Request.Path.Contains("WebResource.axd") && httpApplication.Context.Request.QueryString["c"] == null)
         {
             if (httpApplication.Application[text] == null)
             {
                 CompressionModule.AddCompressedBytesToCache(httpApplication, text);
             }
             CompressionModule.SetEncoding((string)httpApplication.Application[text + "enc"]);
             httpApplication.Context.Response.ContentType = "text/javascript";
             httpApplication.Context.Response.BinaryWrite((byte[])httpApplication.Application[text]);
         }
     }
 }