Global.asax 上的 ASP.NET gzip 脚本和 CSS
我正在我的应用程序中实现这个库,GZip 将您网站的 HTML/CSS/脚本压缩为代码。
如果我在 Visual Studio 中运行该网站,它会运行得很好,但是当我编译网站并在 IIS 中发布时,它只会 gzip ASPX 文件,而不是 CSS 或 JavaScript 文件。
有没有更好的方法在与 Visual Studio 2005 相对应的 C# 中实现 JavaScript 和 CSS gzip(更改 IIS 不是一个选项,因为它必须在代码中)。
I am implementing this library in my application, GZip compress your website's HTML/CSS/Script in code.
It Works very well if I run the site in Visual Studio, but when I compile my site and publish in IIS it only gzip ASPX files, not CSS or JavaScript files.
Is there a better way for implementing JavaScript and CSS gzip in C# corresponding to Visual Studio 2005 (changing the IIS is not an option as it has to be in the code).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,您需要创建一个 HttpHandler 来处理它:
然后您需要在 web.config 中添加处理程序映射:
First, you need to create an HttpHandler for processing it:
Then you need to add a handler mapping in your web.config: