EDIT So I managed to fix it by defining an Application_Error method in my Global.asax and call Response.ClearConten
Application_Error
Global.asax
Response.ClearConten