The error is thrown because a call to response.End() is made inside of ExportToHttpResponse. Remove your calls to Flush and Close the response and wrap your call to ExportToHttpResponse inside a try/catch block to catch and ignore the System.Threading.ThreadAbortException.