473,545 Members | 1,893 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

An exception of type 'System.Threadi ng.ThreadAbortE xception'

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.Threadi ng.ThreadAbortE xception' occurred in mscorlib.dll but was not handled in user code
What can be done to avoid the above message?
Dim lIsMailwasExexu ted As Boolean
Try
oSMTP.Send(oMai lMessage)
lIsMailwasExexu ted = True

Catch smtpEx As SmtpException
ClientScript.Re gisterStartupSc ript(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.Re gisterStartupSc ript(Me.GetType (), "General Problem", String.Format(" alert('There was a general problem! Please contact us by phone! {0}');", " " & generalEx.Messa ge.Replace("'", "\'")), True)
End Try

If lIsMailwasExexu ted = True Then
Server.Transfer ("Thankyou.htm" , True)
Else
Server.Transfer ("Display_Err_M essage.htm", True)
End If

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

Thanks,

Joe






Dec 29 '07 #1
1 2024
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.Threadi ng.ThreadAbortE xception' occurred in mscorlib.dll but was not handled in user code
What can be done to avoid the above message?
Dim lIsMailwasExexu ted As Boolean
Try
oSMTP.Send(oMai lMessage)
lIsMailwasExexu ted = True

Catch smtpEx As SmtpException
ClientScript.Re gisterStartupSc ript(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.Re gisterStartupSc ript(Me.GetType (), "General Problem", String.Format(" alert('There was a general problem! Please contact us by phone! {0}');", " " & generalEx.Messa ge.Replace("'", "\'")), True)
End Try

If lIsMailwasExexu ted = True Then
Server.Transfer ("Thankyou.htm" , True)
Else
Server.Transfer ("Display_Err_M essage.htm", True)
End If

2) Since I move the code If lIsMailwasExexu ted = True Then.... outside of the Try...Catch..En dTry 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
6764
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 this exception occur? Thanks. ------------------------------------ {"Thread was being aborted." }
5
5726
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 thread.Abort()) is reported twice: once in the debug window, and once through the message box. Is it because the thread was sleeping when the...
2
5170
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 downloaded Excel file is what I want. The problem is that every time this code runs, my "catch all" exception handler (an HTTP Module) catches the...
4
2889
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 e) { Debug.WriteLine("WWWPage.Search_Click()"); ... try
1
3007
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 called; here's the code: protected void Search_Click(object sender, EventArgs e) { Debug.WriteLine("WWWPage.Search_Click()"); ...
2
2817
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 Files\webenergy\3b3a5a9b\7ac72ea\App_Web_3uqg9g-v.dll', Symbols loaded. 'WebDev.WebServer.EXE' (Managed): Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET...
4
4892
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
2807
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 when closing the application (maybe in the dispose method?). Here are 2 examples: System.Threading.ThreadAbortException: Thread was being...
3
2863
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++ try/catch logic and allocates memory using calloc. 2. The managed thread is aborted before step 1 can complete. In a pure managed environment, you...
0
7416
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7676
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7932
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6001
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5347
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3456
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1905
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1032
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
729
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.