Nepethya Rana

Nepethya Rana

  • NA
  • 335
  • 152.1k

Exception Message : Thread was being aborted.

Oct 12 2017 2:30 PM
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();

Answers (1)