OutputCache VaryByContentEncodings gzip doesn't work OutputCache VaryByContentEncodings gzip doesn't work asp.net asp.net

OutputCache VaryByContentEncodings gzip doesn't work


Funny mistake, I've just forgot to put the Location attribute and therefore I've got an error. However, Microsoft put this code on their website, and that lead me to think that this code should work AS IS.

http://msdn.microsoft.com/en-us/library/system.web.httpcachepolicy.varybycontentencodings.aspx


  • What version isyour app pool running?
  • Is the directive in a page, control ormasterpage?

VaryByContentEncodings is introduced in the .NET Framework version 3.5.

HttpCachePolicy.VaryByContentEncodings Property


I just had exactly the same problem. The problem is - Visual Studio intellisense suggests you an incorrect attribute name. The correct one, is "VaryByContentEncoding" - withough the "s" in the end.

Correct:

<%@ OutputCache ... VaryByContentEncoding="gzip"  %>

Incorrect:

<%@ OutputCache ... VaryByContentEncodings="gzip"  %>