I just implemented a page that performs a Response.Redire ct(url, true). As
such, I wrapped it in a try catch, and explicitly caught a
ThreadAbortExce ption. However, the thread abort exception was still thrown
at every catch block above the try/catches level, as well as at the *same*
level as the try/catch. This does not seem like proper behavior at all. Once
I've caught the exception, why is it still propagating up the stack? I could
maybe understand it going up the stack, but how it it getting into catch
blocks at the same level? Below is some code that illustrates what happened.
function void doStuff(string url) {
try {
try {
Response.Redire ct(url, true);
} catch (ThreadAbortExc eption) {
//This is hit
Logger.Log("Abo rted");
}
try {
} catch (Exception e) {
//This is hit.
Logger.Log(e, "Aborted same level");
}
} catch (Exception e) {
//This is hit.
Logger.Log(e, "Aborted level above");
}
}
All of those Log statements are hit unless for each one I put a "catch
(ThreadAbortExc eption)" in there. What is going on here, and why?
Thanks,
Steve 3 1893
I dont know why it is behaving like this in your case. But you can avoid the
threadabortexce ption by passing "false" as second parameter to
response.redire ct.
--
Saravana
Microsoft MVP - ASP.NET www.extremeexperts.com
"Steve - DND" <steve!@!digita lnothing.com> wrote in message
news:Oy******** ******@TK2MSFTN GP12.phx.gbl... I just implemented a page that performs a Response.Redire ct(url, true). As such, I wrapped it in a try catch, and explicitly caught a ThreadAbortExce ption. However, the thread abort exception was still thrown at every catch block above the try/catches level, as well as at the *same* level as the try/catch. This does not seem like proper behavior at all.
Once I've caught the exception, why is it still propagating up the stack? I
could maybe understand it going up the stack, but how it it getting into catch blocks at the same level? Below is some code that illustrates what
happened. function void doStuff(string url) { try { try { Response.Redire ct(url, true); } catch (ThreadAbortExc eption) { //This is hit Logger.Log("Abo rted"); }
try {
} catch (Exception e) { //This is hit. Logger.Log(e, "Aborted same level"); } } catch (Exception e) { //This is hit. Logger.Log(e, "Aborted level above"); } }
All of those Log statements are hit unless for each one I put a "catch (ThreadAbortExc eption)" in there. What is going on here, and why?
Thanks, Steve
But then it will continue to process any code left on the page, won't it? So
I would have to implement a class level variable indicating that no further
processing should occur. Correct?
Steve
"Saravana [MVP]" <sa******@sct.c o.in.nospam> wrote in message
news:ul******** *****@TK2MSFTNG P11.phx.gbl... I dont know why it is behaving like this in your case. But you can avoid
the threadabortexce ption by passing "false" as second parameter to response.redire ct.
-- Saravana Microsoft MVP - ASP.NET www.extremeexperts.com
You are correct, it will process the code after response.redire ct. If you
dont want it to happen, then you shouldnt pass "false" as the parameter
value for EndResponse parameter.
--
Saravana
Microsoft MVP - ASP.NET www.extremeexperts.com
"Steve - DND" <steve!@!digita lnothing.com> wrote in message
news:eh******** *****@TK2MSFTNG P10.phx.gbl... But then it will continue to process any code left on the page, won't it?
So I would have to implement a class level variable indicating that no
further processing should occur. Correct?
Steve
"Saravana [MVP]" <sa******@sct.c o.in.nospam> wrote in message news:ul******** *****@TK2MSFTNG P11.phx.gbl... I dont know why it is behaving like this in your case. But you can avoid the threadabortexce ption by passing "false" as second parameter to response.redire ct.
-- Saravana Microsoft MVP - ASP.NET www.extremeexperts.com
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: amit kumar |
last post by:
I am calling a function which returns pointer to a map.
The declaration of the map is map<int,vectxyz*>. vectxyz is a vector
containing pointer to a class xyz.
For map<int,vectxyz*>* p1
In the called function, I am using p1->find(1) which is returning a
valid iterator and not going to the end. I am returning p1 from the
called function.
...
|
by: Stephan Steiner |
last post by:
Hi
I'm having some weird threading issues.. almost at random, if I dare change
a line of my code, the shutdown sequence gets messed up.
I'm using a thread to receive data from the network, that I suspend and
resume whenver needed. In order to properly shut down the program every
thread has to be aborted. So, I override...
|
by: Mark Phillips |
last post by:
Hello,
I am having a problem in which a file can get stuck open when a thread
that is attempting to write to it gets aborted (ThreadAbortedException
occurs). The log file gets stuck open until the process is shut down
(cannot delete file from Windows Explorer, for example). My test
application stops execution with:
An unhandled exception...
|
by: Vivek |
last post by:
Hi,
I have a question regarding ThreadAbortException. Why is the thread abort
exception rethrown at the end of a catch clause?
Why is ThreadAbortException's behavior designed to be this way?
Thanks in advance
-Vivek
|
by: David Waz... |
last post by:
Moved an app from W/2000 Asp V1.0 to
W/2003, VS/2003, ASPV 1.1
Page runs a long job, uploading 2 large fixed length files
(300,000 rows) into SQL database. A process is run
against the data, and altered flat-files produced.
The job aborts at EXACTLY 105 seconds (1 min, 45 seconds)
regardless of WHERE in the process we are - could be DB...
| |
by: splap20 |
last post by:
Every day a large chunk of XML is posted up to my app via http. The app
interprets this XML and writes results to a SQLServer. Occasionally a
ThreadAbortException is thrown during this process. Despite being
caught, this exception propagates all the way up the call stack. I know
this is by design and that I can use Thread.ResetAbort to stop...
|
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. The question
is: after the ThreadAbortException is thrown, does the childThread
continue run the remaining code in the catch block?
|
by: =?Utf-8?B?RXRoYW4gU3RyYXVzcw==?= |
last post by:
Hi,
I am running a web service which sometimes throws exceptions. I have a
lot of error trapping within the web service, but I have missed the current
problem. I am working on the current issue, but there even when I get this
fixed, there may be others I have not thought of. My immediate problem is
that the web service seems to throw a...
|
by: Zeba |
last post by:
Hi !
I am using a httphandler to perform some url rewriting in my
application. My web.config contains the following entry to direct all
urls containing /App/*.ashx to my class AppHandler.cs in namespace
mySite.Web
<httpHandlers>
<add verb="*" path="App/*.ashx"
type="mySite.Web.AppHandler, App_Code"/>
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
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...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
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...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |