Question

I'm running a project off Visual Studio 2010 on IISExpress and whenever a 500 error is thrown it sends garbage back to the browser, rather than a properly formatted server error message with the exception details. An email gets sent to me with the Exception details and this returns everything properly, its only when it hits the browser that I get the garbage. To give you an idea of what I mean by garbage, this is what I get.

enter image description here

I have no idea why it returns this to me rather than what I would consider a 'normal' exception message with the stack trace. Custom errors in my project are turned off and like I said, I get the proper exception details from the application in an email sender I have set up, but I get this at the browser end.

Was it helpful?

Solution

I eventually found out that this was caused by the application sending GZipped contents without the header that indicated to the browser that is was in fact GZipped, so it just dumped the binary content out. I got round this by adding the following to my Global.asax

Sub Application_Error()
    Response.Filter = Nothing
End Sub

This will strip the filter out of the response when an error occurs, and my error message appears.

All credit to Rick Strahl with this blog post for the workaround. It's not ideal but it works for me and that's all I am really bothered about right now.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top