Question regarding RadCompression

2 posts, 0 answers
  1. Sean
    Sean avatar
    200 posts
    Member since:
    Nov 2010

    Posted 07 Jul 2011 Link to this post


    I am attempting to integrate Rad Controls for AJAX with an MVC View-Page. An issue I had early on has reared its head again during development. If I modify the mark-up for my page such that it is in an erroneous state, and then try and run the page, I would expect to see something akin to "Server Error - Error Message Here." Unfortunately, my error messages are becoming compressed and never decompressed. This leads to garbage characters being rendered on the screen instead of a helpful error message.

    The first time I encountered this issue it was code in our solution --

    public override void OnActionExecuting(ActionExecutingContext context)
        //This compression filter eats server errors. I'd like to see them during debugging.
        if (!HttpContext.Current.IsDebuggingEnabled)
            HttpRequestBase request = context.HttpContext.Request;
            string acceptEncoding = request.Headers["Accept-Encoding"];
            if (string.IsNullOrEmpty(acceptEncoding))
            acceptEncoding = acceptEncoding.ToUpperInvariant();
            HttpResponseBase response = context.HttpContext.Response;
            if (acceptEncoding.Contains("GZIP"))
                response.AppendHeader("Content-encoding", "gzip");
                response.Filter = new GZipStream(response.Filter, CompressionMode.Compress);
            else if (acceptEncoding.Contains("DEFLATE"))
                response.AppendHeader("Content-encoding", "deflate");
                response.Filter = new DeflateStream(response.Filter, CompressionMode.Compress);

    After adding in the check for debugging I began seeing my helpful error messages again.

    Now, I recently went into my web.config and added the lines necessary to enable RadCompression. My issue has arisen once again -- I see garbage characters instead of error messages.

    Is there something I should be checking elsewhere in my code, the data type of the stream or something, to account for errors + RadCompression?

    Kind regards,

  2. Martin
    Martin avatar
    823 posts

    Posted 12 Jul 2011 Link to this post

    Hello Sean,

    I have tried to reproduce the issue locally, but without success. One possible option causing the problem might be another compression that runs alongside RadCompression and results in double compression of the response. Could you please verify that for your project? If the case is different, please consider opening a formal support ticket and send me a small sample demonstrating your scenario. This way I will be able to debug it locally and provide you with more to the point resolution.

    I hope this helps.

    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Back to Top