RadCompression and Zip file downloads

2 posts, 0 answers
  1. Dave
    Dave avatar
    3 posts
    Member since:
    Jul 2011

    Posted 03 Nov 2011 Link to this post

    We're using RadCompression in our project and I've run into a small snag.  On one of our pages, we download a Zip file to the client.  We're using pretty standard code to download the file (similar to the following:  link), but the resulting file on the client is always coming up as corrupted.  I've verified that the source file on the server is good. 

    After digging around a little, I tried disabling the EnablePostbackCompression setting in the web.config.  Now, the downloads are just fine.  So, is there a way to turn this setting off for a specific postback?  Or is there a better way to have both postback compression and the ability to download zip files?  Any help is appreciated!

  2. Martin
    Martin avatar
    823 posts

    Posted 08 Nov 2011 Link to this post

    Hello Dave,

    The described behavior is expected due to the fact that you have enabled RadCompression for postbacks, thus the page's response will pass through the RadCompression's module even when a full postback occurs. Therefore you should either disable the compression for postbacks (leaving it for ajax requests) (code snippet 1) or disable the compression for the page in question at all (code snippet 2). Both those approaches can be achieved by decorating the page's class with RadCompressionSettings attribute similar to the following:

    [RadCompressionSettings(EnablePostbackCompression = false)] 
    public partial class Defaults : System.Web.UI.Page 


    [RadCompressionSettings(HttpCompression = CompressionType.None)] 
    public partial class Defaults : System.Web.UI.Page 

    I hope this helps.

    All the best,
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Back to Top