An exception of type 'System.Threading.ThreadAbortException'

Discussion in 'ASP .Net' started by JoeP, Dec 29, 2007.

  1. JoeP

    JoeP Guest

    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
     
    JoeP, Dec 29, 2007
    #1
    1. Advertising

  2. JoeP

    JoeP Guest

    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
     
    JoeP, Dec 31, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lee Simpson
    Replies:
    0
    Views:
    1,579
    Lee Simpson
    Jul 18, 2003
  2. Henrik Stidsen
    Replies:
    5
    Views:
    22,866
    Henrik Stidsen
    Sep 1, 2006
  3. Replies:
    1
    Views:
    512
    parez
    Oct 12, 2006
  4. Daniel Knöpfel
    Replies:
    2
    Views:
    1,173
    Daniel Knöpfel
    Jan 8, 2007
  5. Replies:
    1
    Views:
    2,057
    senfo
    Feb 27, 2007
Loading...

Share This Page