By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,469 Members | 1,050 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,469 IT Pros & Developers. It's quick & easy.

2.0: exception "Thread was being aborted"

P: n/a
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()");
...
try // only for debugging purposes
{
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

My .NET Framework setup was successful, I use Framework a few
months and there was no such problems.
I got your suggestion to use Response.Redirect("...", true) but
doesn't help (same result). Neither Response.Redirect("...", false).

Could you tell me please how to solve the problem?
Thank you for your help.
/RAM/
May 22 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Copied and pasted from a previous post by Karl:

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/
R.A.M. wrote:
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()");
...
try // only for debugging purposes
{
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

My .NET Framework setup was successful, I use Framework a few
months and there was no such problems.
I got your suggestion to use Response.Redirect("...", true) but
doesn't help (same result). Neither Response.Redirect("...", false).

Could you tell me please how to solve the problem?
Thank you for your help.
/RAM/

May 22 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.