Compressing ASPX pageview in code or compress HTTP in IIS?
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 ha开发者_如何学编程ve 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
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.
精彩评论