Beispiel #1
0
        private void CompressDynamicContent(object sender, EventArgs e)
        {
            if (Globals.UseDynamicCompress && !Common.CommonUtil.ContainsInstalledKey(Context) && Context.Items.Contains("need-compress"))
            {
                if (string.IsNullOrEmpty(Context.Request.Form["_ajaxpanelid"]) && string.IsNullOrEmpty(Context.Request.QueryString["_ajaxpanelid"]))
                {
                    Common.CommonUtil.SetInstalledKey(Context);

                    string realPath = Request.Path.Remove(0, Request.ApplicationPath.Length + 1);

                    Response.Cache.VaryByHeaders["Accept-Encoding"] = true;

                    CompressingType compressingType = RequestUtil.GetCompressingType(Context);

                    if (compressingType == CompressingType.GZip)
                    {
                        Response.Filter = new GZipFilter(Response.Filter);
                    }
                    else if (compressingType == CompressingType.Deflate)
                    {
                        Response.Filter = new DeflateFilter(Response.Filter);
                    }
                }
            }
        }