An exception of type 'System.Threading.ThreadAbortException'

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
 
J

JoeP

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top