private void context_BeginRequest(object sender, EventArgs e) { HttpApplication httpApplication = (HttpApplication)sender; if (httpApplication.Request.Path.Contains("WebResource.axd")) { CompressionModule.SetCachingHeaders(httpApplication); if (CompressionModule.IsBrowserSupported() && httpApplication.Context.Request.QueryString["c"] == null && (CompressionModule.IsEncodingAccepted("deflate") || CompressionModule.IsEncodingAccepted("gzip"))) { httpApplication.CompleteRequest(); } } }
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]); } } }