473,385 Members | 1,908 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

An exception of type 'System.Threading.ThreadAbortException'

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






Dec 29 '07 #1
1 2017
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

Dec 31 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Jan | last post by:
Hi, If I put a try catch block for Server.Transfer call. It will catch a System.Threading.ThreadAbortException exception like this. However, it transfer the page to the correct page. Why did...
5
by: Lucvdv | last post by:
Can someone explain why this code pops up a messagebox saying the ThreadAbortException wasn't handled? The first exception is reported only in the debug pane, as expected. The second (caused by...
2
by: Jeff | last post by:
I have some code that enables users to download the contents of a DataGrid as an Excel file. The following code snippet is the relevant part. It works just fine - meaning specifically that the...
4
by: R.A.M. | last post by:
Hello, Could you help me plase? I have an ASP.NET page with "Search" button; when button is clicked Search_Click is called; here's the code: protected void Search_Click(object sender, EventArgs...
1
by: R.A.M. | last post by:
Hello, Could you help me plase? I am describing my problem second time because I haven't got a solution. I have an ASP.NET page with "Search" button; when button is clicked Search_Click is...
2
by: Henry | last post by:
Does anyone have any clue what this is about? 'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET...
4
by: Totto | last post by:
Hi, I'm doing a server.transfer from a click event of a button, but an exception is raised with "Thread was being aborted" Anyone know why? Thanks Tor
10
by: =?Utf-8?B?ZHNoZW1lc2g=?= | last post by:
Hello, I have a C# project with windows forms. I sometimes get unprdictable .NET exceptions. I don't always get them, so I can't reproduce where exactly it happens. I can generally say it happens...
3
by: osudude | last post by:
What happens in the following scenario? 1.Via a DLL interface, a managed thread kicks off a potentially long running FOR loop operation encapsulated by a native C++ dll. This FOR loop has C++...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.