HTTP Compression with ASP.NET 4.0 and IIS7

I have been trying to perform HTTP compression on several of my sites for some time.

I tried to implement HTTP compression using variations of the following two methods:

From Application_BeginRequest to Global.asax

From Custom HttpModule

In both cases, it seems to work. But when I wind around the site, I quickly lose CSS style. And the Browser reports that the JS file contains invalid characters. And, at some point, the whole site completely turns into a laugh.

I'm sure I knew what was going on here. Does anyone have any suggestions? Is this because these methods only work in older versions of ASP.NET/IIS?

EDIT: I do not have access to IIS, and I should not require it. With the latest iterations of ASP.NET and IIS, more and more controls are passed to web.config without touching IIS. This should be fully supported without delving into IIS, and essentially the two links above claim that they can do this. I just can't get it to work for me.

EDIT: Upon further verification, using the code in the second link above (HTTP module), I see that the module handler is called for all file types on my site. This is clearly part of the problem. (Note that in some cases the whole page turns into garbage, which indicates other problems.) Can anyone assume that it determines which files are sent to the HTTP handler, or why the code on this link may work for someone, besides me

+3
source share
2 answers

While I might have had several problems, the following quote from the Walkthrough: creating and registering a custom HTTP module seems to highlight the problem:

ASP.NET IIS 6.0, HTTP- , ASP.NET. - ASP.NET( .aspx), - ( .asmx), ASP.NET( .ashx) , ASP.NET. ASP.NET IIS 7.0, HTTP- , IIS. ASP.NET, HTML ( .htm .html), ..

, ASP.NET 4.0 IIS7. , . , HTTP , IIS.

, . , .

+1

IIS 7 - . , , -, , .

+3

Source: https://habr.com/ru/post/1791874/


All Articles