473,473 Members | 1,955 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Try Catch Finally and Threads

I have code that Posts Form values to another page.

I am using a Try Catch Finally to handle thrown exceptions from our core
logic.

The problem is if everything is successful it Posts the page, the post has
to run inside the try catch statement; however, I get a ThreadException when
it trys to post and it just stops everything (no post).

BTW, this code works great if it is not in a try catch statement.

Is there a way I can stop monitoring of the thread and let everything else
continue to run?

I have tried the following and it does not work.
System.Threading.Thread.CurrentThread.ResetAbort
System.Threading.Thread.CurrentThread.Abort

System.Threading.Thread.CurrentThread.Suspend

System.Threading.Thread.CurrentThread.Sleep

Thanks!

-Wayne

Jun 6 '06 #1
2 1558
What are you using to post the form data? HttpWebRequest? WebClient?

What do you mean by monitoring of the thread?

Wayne wrote:
I have code that Posts Form values to another page.

I am using a Try Catch Finally to handle thrown exceptions from our core
logic.

The problem is if everything is successful it Posts the page, the post has
to run inside the try catch statement; however, I get a ThreadException when
it trys to post and it just stops everything (no post).

BTW, this code works great if it is not in a try catch statement.

Is there a way I can stop monitoring of the thread and let everything else
continue to run?

I have tried the following and it does not work.
System.Threading.Thread.CurrentThread.ResetAbort
System.Threading.Thread.CurrentThread.Abort

System.Threading.Thread.CurrentThread.Suspend

System.Threading.Thread.CurrentThread.Sleep

Thanks!

-Wayne

Jun 6 '06 #2
If its ThreadAbortException then ignore it. If you will try to redirect from
a page or cause the execution to shoft to another page, the thread has to
abort itself before it can start a new thread for the new page. It is by
design.
"Wayne" <wa***@nospam.cfwebmasters.com> wrote in message
news:ea**************@TK2MSFTNGP05.phx.gbl...
I have code that Posts Form values to another page.

I am using a Try Catch Finally to handle thrown exceptions from our core
logic.

The problem is if everything is successful it Posts the page, the post has
to run inside the try catch statement; however, I get a ThreadException
when it trys to post and it just stops everything (no post).

BTW, this code works great if it is not in a try catch statement.

Is there a way I can stop monitoring of the thread and let everything else
continue to run?

I have tried the following and it does not work.
System.Threading.Thread.CurrentThread.ResetAbort
System.Threading.Thread.CurrentThread.Abort

System.Threading.Thread.CurrentThread.Suspend

System.Threading.Thread.CurrentThread.Sleep

Thanks!

-Wayne


Jun 7 '06 #3

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

Similar topics

5
by: Simon Johnson | last post by:
Recently, a thread appeared which asked how to create a "catch all" method for when an exception occurs within a program. The solution given only works for Windows Forms applications, as far as i...
16
by: Bill | last post by:
Say I have a childThread currently is running a finally block to cleanup external resources. At the same time the main thread calls childThread.Abort(). The question is: when the...
5
by: C# beginner | last post by:
Hi all If inside a try-catch-finally block, return statements are used, will the finally block get executed or not? Your replies are very important to me. Thanks a lot.
8
by: Z D | last post by:
Hi, I was wondering what's the point of "finally" is in a try..catch..finally block? Isn't it the same to put the code that would be in the "finally" section right after the try/catch block?...
23
by: VB Programmer | last post by:
Variable scope doesn't make sense to me when it comes to Try Catch Finally. Example: In order to close/dispose a db connection you have to dim the connection outside of the Try Catch Finally...
7
by: Sean Kirkpatrick | last post by:
I got caught with my pants down the other day when trying to explain Try...Catch...Finally and things didn't work as I had assumed. Perhaps someone can explain to me the purpose of Finally. I've...
32
by: cj | last post by:
Another wish of mine. I wish there was a way in the Try Catch structure to say if there wasn't an error to do something. Like an else statement. Try Catch Else Finally. Also because I...
6
by: foolmelon | last post by:
If a childThread is in the middle of a catch block and handling an exception caught, the main thread calls childThread.Abort(). At that time a ThreadAbortException is thrown in the childThread. ...
3
by: Eran.Yasso | last post by:
Hi, I wondering where should i use finally and where should i use catch? I have a thread, which the thread dispatcher waits for the thread. if i abort the thread, an exception happens. why...
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,...
0
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...
1
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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...

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.