This is a migrated thread and some comments may be shown as answers.

Question regarding RadCompression

1 Answer 48 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sean
Top achievements
Rank 2
Sean asked on 07 Jul 2011, 07:37 PM
Hello,

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))
            return;
 
        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,

Sean

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 12 Jul 2011, 04:20 PM
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.

Regards,
Martin
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!

Tags
General Discussions
Asked by
Sean
Top achievements
Rank 2
Answers by
Martin
Telerik team
Share this question
or