locked
GzipStream/DeflateStream conflict with OutputCache RRS feed

  • Question

  • User-782944879 posted

    Hi all,

    I managed to find some strange behaviour with the GzipStream / DeflateStream conflicting with the OutputCache .....

    For some reason if I get to work both GzipStream/DeflateStream and the OutputCache working the result would be garbage lot, after some clicking between the pages having OutputCache..

    why is this? I already posted this and got no answer... but figured it out on when is it happening.. if I remove either one it would work normally. 

     

    For the code GzipStreaming and DeflateStreaming I got it from where

    http://aspalliance.com/1348_Understanding_Compression_and_Decompression_in_ASPNET_20.3

     Anyone knows why? Or any workaround? Do I have to restrict myself in using only one of the features?

     I believe this is a bug but anyway....

    Thanks!

     

    Thursday, November 20, 2008 11:07 AM

Answers

  • User-1136466523 posted

    Hi,

    <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p>

    Http compression is applied before output cache so if you are using output cache along with compression then you can get into trouble, for example if your first request accepts deflate compression then server will cache compressed copy and it will serve that copy to all corresponding request untill it remains in cache.

    <o:p> </o:p>

    To avoid this problem you can use varybycustom along with outputcache and then set value of varybycustom in global.asax to encoding that you are using.

    <o:p> </o:p>

    Thanks.

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, November 25, 2008 12:59 AM

All replies

  • User-782944879 posted

    Is this the official forum regarding ASP.NET ?

    I'm not receiving any replies about this issue which in my opinion is worth looking at... 

    how many times I posted about this issue without having an answer? ..

    Any Microsoft Experts or perhaps .NET framework developer themselves?!

    Monday, November 24, 2008 8:41 AM
  • User-1136466523 posted

    Hi,

    <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p>

    Http compression is applied before output cache so if you are using output cache along with compression then you can get into trouble, for example if your first request accepts deflate compression then server will cache compressed copy and it will serve that copy to all corresponding request untill it remains in cache.

    <o:p> </o:p>

    To avoid this problem you can use varybycustom along with outputcache and then set value of varybycustom in global.asax to encoding that you are using.

    <o:p> </o:p>

    Thanks.

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, November 25, 2008 12:59 AM
  • User-782944879 posted

    Hi Nai-Dong--Jin, thanks for replying after all Does this mean that either one will be used? Thanks!

    Tuesday, November 25, 2008 5:23 PM
  • User-1136466523 posted

    Hi,

    <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p>

    Yes, both of them take effect in the page processing. But one copy of cache should not for all clients. We need to use VaryByCustom to identify different clients, since one compressed copied is not suitable for all clients.

    <o:p> </o:p>

    Thanks.

     

    Wednesday, November 26, 2008 12:14 AM
  • User-782944879 posted

     Hello again Nai-Dong-Jin,

     

    I didn't quite understand what do you mean by compressed copied is not suitable for all clients. Why not?

    And why not one copy of cache be compressed and given to each client?.. this would double the speed I am using the VaryByContentEncoding .. so sometimes the OutputCache will be used and others the Gzip will be used?

    Thanks again!

    Wednesday, November 26, 2008 9:07 AM
  • User-766726400 posted

    Hi Varangian,

    Did you found a solution for the problem you posted here ?, because i have the same problem and i would like to solve it...

    Please if you could share a example of how to do it, would be much better for me.

    Thanks

    Regards

    Monday, May 10, 2010 11:22 PM