Click here to Skip to main content
15,886,518 members

Exception message : thread was being aborted.

s23user asked:

Open original thread
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();


What I have tried:

I tried to run the application in dev environment. I never got that issue. I could not reproduce the error.
Tags: Visual Basic, C# 5.0, ASP.NET

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900