在代码中压缩 ASPX 页面视图或在 IIS 中压缩 HTTP?

发布于 2024-10-09 10:16:38 字数 361 浏览 0 评论 0原文

过去,对于具有大视图状态的页面,我重写了 PageStatePersister 类,因此在保存状态时我会对其进行压缩。在加载时我将其解压缩。我还没有真正考虑过这个问题,但是 IIS 可以更好地处理这样的事情吗?我这样做的原因是为了让我的页面更精简,因为页面上有很多自定义控件并且视图状态很大。这是我获取原始代码的地方:

http://www.codeproject .com/KB/viewstate/ViewStateCompression.aspx?msg=1906999

In the past, with pages with large viewstate I have overridden the PageStatePersister class so when the state is saved I compress it. On Load I decompress it. I have haven't really thought about it, but could IIS handle something like this better? The reason I did this was to keep my pages slimmer because I have a lot of custom controls on the page and the viewstate was huge. This is where I got my original code from:

http://www.codeproject.com/KB/viewstate/ViewStateCompression.aspx?msg=1906999

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

美煞众生 2024-10-16 10:16:38

我们在 IIS 级别进行压缩,它使事情变得更干净、更简单。然而,我们只是一个具有一种用途的网站,当您转移到多个网站以及您可能不想压缩内容的类似网站时,事情就会开始变得混乱。

我认为 IIS7 的情况有所改善,您可以进行按站点压缩。

您还可以将所有内容作为一个整体进行压缩,而不仅仅是页面的一部分,这可能意味着整体压缩率更高。

We compress at the IIS level, it makes things cleaner and simpler. However we're just one website with one use, things start to get messed as you move to multiple websites and the like with which you might not want to compress content.

I think the situation improved with IIS7 though and you can do per-site compression.

You also have the benefit of compressing everything as a whole rather than just one part of the page which may mean a better compression ratio overall.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文