How to implement GZip compression in ASP.NET?

后端 未结 9 871
后悔当初
后悔当初 2020-11-27 10:21

I am trying to implement GZip compression for my asp.net page (including my CSS and JS files). I tried the following code, but it only compresses my .aspx page (found it fro

9条回答
  •  难免孤独
    2020-11-27 10:59

    In IIS7 all requests go to .net, so you would have to create an HttpModule that added those headers to all responses.

    Without IIS7, and on shared hosting, you would have to creare a handler that mapped a .net file extention that you are not using (like .asmx) and in the web.config specify that .asmx files go to your HttpHandler which is set to rewrite the path to .jpg or whatever and set the header there too.

提交回复
热议问题