Exception Message : Thread was being aborted. I am getting above exception when running the application in prod server. I never get that exception in dev and in test environment. Could any please help me out. If there is anything wrong in the code. My code in vb. Try Dim filePath As String = Request.QueryString("fn") Response.ContentType = ContentType Response.AppendHeader("content-disposition", "attachment; filename=" + Path.GetFileName(filePath)) Response.TransmitFile(filePath) Response.Flush() System.Threading.Thread.Sleep(1000) If File.Exists(filePath) Then File.Delete(filePath) End If Response.End() Catch ex As Exception oUtility.WriteLog("Exception Message : " + ex.Message, True) vm.stat = 2 vm.message = "Internal server error" Throw End Try My code in C# string filePath = Request.QueryString["fn"]; Response.ContentType = ContentType; Response.AppendHeader("content-disposition", "attachment; filename=" + Path.GetFileName(filePath)); Response.TransmitFile(filePath); Response.Flush(); System.Threading.Thread.Sleep(1000); if (File.Exists(filePath)) { File.Delete(filePath); } //response.writefile(filepath) Response.End();
HttpResponse.End Method (System.Web)[^]:To mimic the behavior of the End method in ASP, this method tries to raise a ThreadAbortException exception. If this attempt is successful, the calling thread will be aborted, which is detrimental to your site's performance. In that case, no code after the call to the End method is executed.
Response.End()
Application.CompleteRequest()
Response.End
ThreadAbortException
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)