在Asp.net中使用压缩 [英] Using Compression in Asp.net

查看:77
本文介绍了在Asp.net中使用压缩的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我需要使用Asp.net中的Comperssions,它会在加载时开始压缩.
任何人都可以通过示例或示例指导我.


问候,
Yuvi

解决方案

您可以通过HTTP使用GZIP压缩,从而减小ASP.NET中的页面大小.

 受保护的 覆盖  void  OnLoad(EventArgs e)
    {
    //  
    // 应用GZIP压缩(或DEFLATE)
    //  
    Response.Filter =  GZipStream(Response.Filter,
        CompressionMode.Compress);
    Response.AddHeader(" "  gzip");
    } 


看看 C#GZipStream示例 [ ASP.NET HTTP压缩概述 [在IIS 7中配置HTTP压缩 [ http://www.microsoft.com. com/technet/prodtechnol/WindowsServer2003/Library/IIS/502ef631-3695-4616-b268-cbe7cf1351ce.mspx?mfr = true [ http://www.iis.net/ConfigReference/system.webServer/httpCompression [ ^ ]


这里是一个很好的编写好的代码,可以在gzip中压缩网站并进行压缩.
单击此处


Hi,

I need to use the Comperssions in Asp.net, which starts compressing at the time of loading.
Can any one guide me with samples or examples.


Regards,
Yuvi

解决方案

you can use GZIP compression over HTTP can reduce page size in ASP.NET

protected override void OnLoad(EventArgs e)
    {
    //
    // Apply GZIP compression (or DEFLATE)
    //
    Response.Filter = new GZipStream(Response.Filter,
        CompressionMode.Compress);
    Response.AddHeader("Content-Encoding", "gzip");
    }


Have a look for C# GZipStream Example[^]

Reference Link ASP.NET HTTP Compression Overview[^]

You can also go for
Configuring HTTP Compression in IIS 7[^]


Maybe it''s an option for you, use compression in IIS

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/502ef631-3695-4616-b268-cbe7cf1351ce.mspx?mfr=true[^]

http://www.iis.net/ConfigReference/system.webServer/httpCompression[^]


Here is a nice well written code to compress site in gzip and deflate.
Click here


这篇关于在Asp.net中使用压缩的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆