An exception of type 'System.Threading.ThreadAbortException'

  • Thread starter Thread starter JoeP
  • Start date Start date
J

JoeP

Hi All,

1)
I am using code like the below outside of the Try.. Catch... Endtry and getting this message
Within the Immediate Window.

An exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll but was not handled in user code


What can be done to avoid the above message?


Dim lIsMailwasExexuted As Boolean


Try
oSMTP.Send(oMailMessage)
lIsMailwasExexuted = True

Catch smtpEx As SmtpException
ClientScript.RegisterStartupScript(Me.GetType(), "E-Mail Problem", String.Format("Alert('There was a problem in sending the email: Please contact us by phone! {0}');", " " & smtpEx.Message.Replace("'", "\'")), True)

Catch generalEx As Exception
ClientScript.RegisterStartupScript(Me.GetType(), "General Problem", String.Format("alert('There was a general problem! Please contact us by phone! {0}');", " " & generalEx.Message.Replace("'", "\'")), True)
End Try

If lIsMailwasExexuted = True Then
Server.Transfer("Thankyou.htm", True)
Else
Server.Transfer("Display_Err_Message.htm", True)
End If

2) Since I move the code If lIsMailwasExexuted = True Then.... outside of the Try...Catch..EndTry then err message under the Catch is not displayed anymore.
Any idea why?

Thanks,

Joe
 
Hi There,

Apprecaite any feedback.

Thanks,

Joe
Hi All,

1)
I am using code like the below outside of the Try.. Catch... Endtry and getting this message
Within the Immediate Window.

An exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll but was not handled in user code


What can be done to avoid the above message?


Dim lIsMailwasExexuted As Boolean


Try
oSMTP.Send(oMailMessage)
lIsMailwasExexuted = True

Catch smtpEx As SmtpException
ClientScript.RegisterStartupScript(Me.GetType(), "E-Mail Problem", String.Format("Alert('There was a problem in sending the email: Please contact us by phone! {0}');", " " & smtpEx.Message.Replace("'", "\'")), True)

Catch generalEx As Exception
ClientScript.RegisterStartupScript(Me.GetType(), "General Problem", String.Format("alert('There was a general problem! Please contact us by phone! {0}');", " " & generalEx.Message.Replace("'", "\'")), True)
End Try

If lIsMailwasExexuted = True Then
Server.Transfer("Thankyou.htm", True)
Else
Server.Transfer("Display_Err_Message.htm", True)
End If

2) Since I move the code If lIsMailwasExexuted = True Then.... outside of the Try...Catch..EndTry then err message under the Catch is not displayed anymore.
Any idea why?

Thanks,

Joe
 
Back
Top