473,287 Members | 1,574 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,287 software developers and data experts.

2.0: unexpected exception "Thread was being aborted"

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
{
Response.Redirect("Searched.aspx");
}
catch (Exception ex)
{
Debug.WriteLine(
"WWWPage.Search_Click(): exception: " +
ex.Message);
}
}

Unfortunatelly Redirect does not work. Here what I found in Output
window:

WWWPage.Search_Click()
A first chance exception of type
'System.Threading.ThreadAbortException' occurred in mscorlib.dll
WWWPage.Search_Click(): exception: Thread was being aborted.
A first chance exception of type
'System.Threading.ThreadAbortException' occurred in
App_Web_2xx5zf8y.dll
An exception of type 'System.Threading.ThreadAbortException' occurred
in App_Web_2xx5zf8y.dll but was not handled in user code

Could you explain me please what is going on and how to correct the
problem? My .NET Framework setup was successful, I use Framework a few
months and there was no such problems.
Thank you very much.
/RAM/
May 18 '06 #1
4 2867
Try:

Response.redirect("Searched.aspx", true);

and take it out of the try catch.

R.A.M. wrote:
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
{
Response.Redirect("Searched.aspx");
}
catch (Exception ex)
{
Debug.WriteLine(
"WWWPage.Search_Click(): exception: " +
ex.Message);
}
}

Unfortunatelly Redirect does not work. Here what I found in Output
window:

WWWPage.Search_Click()
A first chance exception of type
'System.Threading.ThreadAbortException' occurred in mscorlib.dll
WWWPage.Search_Click(): exception: Thread was being aborted.
A first chance exception of type
'System.Threading.ThreadAbortException' occurred in
App_Web_2xx5zf8y.dll
An exception of type 'System.Threading.ThreadAbortException' occurred
in App_Web_2xx5zf8y.dll but was not handled in user code

Could you explain me please what is going on and how to correct the
problem? My .NET Framework setup was successful, I use Framework a few
months and there was no such problems.
Thank you very much.
/RAM/

May 18 '06 #2
Just for more insight, Response.Redirect throws a ThreadAbordException
intentionally. Technically, Response.Redirect calls Response.End() which
throws the exception.

If you specify true as a 2nd parameter (by default it's false),
Response.End() isn't called, and the page is fully processed before being
redirected.

The real solution to your problem is not to swallow exceptions like you are
doing. You really shouldn't ever catch Exception.

Karl

--
http://www.openmymind.net/

"Ray Booysen" <rj***********@rjb.za.net> wrote in message
news:%2******************@TK2MSFTNGP03.phx.gbl...
Try:

Response.redirect("Searched.aspx", true);

and take it out of the try catch.

R.A.M. wrote:
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
{
Response.Redirect("Searched.aspx");
}
catch (Exception ex)
{
Debug.WriteLine(
"WWWPage.Search_Click(): exception: " +
ex.Message);
}
}

Unfortunatelly Redirect does not work. Here what I found in Output
window:

WWWPage.Search_Click()
A first chance exception of type
'System.Threading.ThreadAbortException' occurred in mscorlib.dll
WWWPage.Search_Click(): exception: Thread was being aborted.
A first chance exception of type
'System.Threading.ThreadAbortException' occurred in
App_Web_2xx5zf8y.dll
An exception of type 'System.Threading.ThreadAbortException' occurred
in App_Web_2xx5zf8y.dll but was not handled in user code

Could you explain me please what is going on and how to correct the
problem? My .NET Framework setup was successful, I use Framework a few
months and there was no such problems.
Thank you very much.
/RAM/

May 18 '06 #3
You made me think...
http://codebetter.com/blogs/karlsegu...18/144851.aspx

Karl
--
http://www.openmymind.net/

"Ray Booysen" <rj***********@rjb.za.net> wrote in message
news:%2******************@TK2MSFTNGP03.phx.gbl...
Try:

Response.redirect("Searched.aspx", true);

and take it out of the try catch.

R.A.M. wrote:
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
{
Response.Redirect("Searched.aspx");
}
catch (Exception ex)
{
Debug.WriteLine(
"WWWPage.Search_Click(): exception: " +
ex.Message);
}
}

Unfortunatelly Redirect does not work. Here what I found in Output
window:

WWWPage.Search_Click()
A first chance exception of type
'System.Threading.ThreadAbortException' occurred in mscorlib.dll
WWWPage.Search_Click(): exception: Thread was being aborted.
A first chance exception of type
'System.Threading.ThreadAbortException' occurred in
App_Web_2xx5zf8y.dll
An exception of type 'System.Threading.ThreadAbortException' occurred
in App_Web_2xx5zf8y.dll but was not handled in user code

Could you explain me please what is going on and how to correct the
problem? My .NET Framework setup was successful, I use Framework a few
months and there was no such problems.
Thank you very much.
/RAM/

May 18 '06 #4
On Thu, 18 May 2006 08:49:44 +0100, Ray Booysen
<rj***********@rjb.za.net> wrote:
Try:

Response.redirect("Searched.aspx", true);

and take it out of the try catch.


It didn't help. Whatever I write:
Response.Redirect("Searched.aspx", false);
Response.Redirect("Searched.aspx", true);
Response.Redirect("Searched.aspx");
I have the exception.
Please help.
/RAM/
May 19 '06 #5

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

Similar topics

1
by: Elliot M. Rodriguez | last post by:
A few of our customers cannot access one of the pages on our vb.net asp.net site. The problems are limited to only a few people, but these people have the problem regularly. The page in question...
3
by: Stephen Miller | last post by:
I have an ASP.Net application that sends a NetworkStream to a .Net Service, which has a TcpListener listening on a port for the ASP.Net client. When it receives a request it creates a new thread...
5
by: Alan Silver | last post by:
Hello, I have a page that is supposed to do some checking, and if OK, set a session variable before redirecting to another page. The following code is a simplified version, I have hard-coded the...
4
by: hitendra15 | last post by:
Hi following is the code which sends file to the browser means user can download file, but the code generates error message Thread Being Aborted., will any one put their thoughts protected void...
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...
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
2
by: =?Utf-8?B?RGFuZGFuIFpoYW5n?= | last post by:
I used Response.Redirect("other.aspx") in my application. This will arise the exception "Thread is being aborted". How can i get rid of this exception? BTW, i can not use the...
1
by: active | last post by:
When I run an app outside of the IDE I get the exception Thread was being aborted Does that error mean something to you? Any idea what might be causing it? ++++++++++++++++
5
by: Neil | last post by:
Hi, Long story short, we use "Server.Execute" to grab the output from an ASPX page ... Server.Execute("page.aspx", textWriter); We've noticed that intermittantly, we get a "Thread was being...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.