Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / December 2007

Tip: Looking for answers? Try searching our database.

An exception of type 'System.Threading.ThreadAbortException'

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JoeP - 29 Dec 2007 03:35 GMT
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 - 31 Dec 2007 00:27 GMT
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

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.