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

Error - mscorlib : Thread was being aborted.

T.
I had the following code inside my app
try
{
// Open an ADO.NET db connection
// Do some db processing here

Response.Redirect("main.htm");
}
catch(Exception e)
{
}

The Response.Redirect("main.htm") state was generating the error 'mscorlib
: Thread was being aborted'. But when I took that statement out of the
try..catch block it ran fine. Why does Ressponse.Redirect cause an error
inside a try..catch statement?

Thanks in advance
Nov 19 '05 #1
2 2499
T.
Clarification: Actually its just the try{} block, runs fine in the
catch(Exceptione) {} block

"T." wrote:
I had the following code inside my app
try
{
// Open an ADO.NET db connection
// Do some db processing here

Response.Redirect("main.htm");
}
catch(Exception e)
{
}

The Response.Redirect("main.htm") state was generating the error 'mscorlib
: Thread was being aborted'. But when I took that statement out of the
try..catch block it ran fine. Why does Ressponse.Redirect cause an error
inside a try..catch statement?

Thanks in advance

Nov 19 '05 #2
A ThreadAbortException is thrown when Redirect is used - it's just how it
works. Why are you doing a catch(Exception e)? If your code can't "handle"
every exception, then I'd suggest not having the catch block there. If there's
a specific exception you know how to deal with, then use the catch (like
FormatException or SqlException for example). To be notified that there was
an unhandled exception (one you didn't catch) you should put a Application_Error
handler in global.asax; this is where your error logging should go.

-Brock
DevelopMentor
http://staff.develop.com/ballen
I had the following code inside my app
try
{
// Open an ADO.NET db connection
// Do some db processing here
Response.Redirect("main.htm");
}
catch(Exception e)
{
}
The Response.Redirect("main.htm") state was generating the error
'mscorlib : Thread was being aborted'. But when I took that statement
out of the try..catch block it ran fine. Why does Ressponse.Redirect
cause an error inside a try..catch statement?

Thanks in advance


Nov 19 '05 #3

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...
1
by: Rachit | last post by:
Hi, I've a WebApp that calls Microsoft CRM WebServices to perform a particular action. In my WebApp I am spawning a new async thread for all the CRM related actions and sending the user to Thank...
6
by: HLady | last post by:
I have been googling and cannot seem to find the answer I seek so I turn to the group. I have an application where I have been receiving 'Thread was being aborted' error ocasionally. In production...
5
by: darrel | last post by:
I have a function that calls a class that writes a dataset that I've passed to it out as an excel spreadheet and returns it to the browser: my function try makeExcelFile(mydataset) catch...
5
by: Jimi | last post by:
Hi all, I have a user control which raises an event to the parent page when a person clicks on a link in a datagrid. In the event handler inside the parent page I construct a url to redirect to...
9
by: esakal | last post by:
Hello, I'm programming an application based on CAB infrastructure in the client side (c# .net 2005) Since my application must be sequencally, i wrote all the code in the UI thread. my...
0
by: pebelund | last post by:
Im having a problem I cant solve atm. I got a webbserver, where Im doing a search, that will list some information. The search goes to a seperate SQL 2000 server, to a stored procedure that runs...
2
by: Daniel Knöpfel | last post by:
Hi I am develloping an asp.net 2.0 application. For some tasks (daily notifications to users via email), we use background threads. I rather have this task as background thread of the asp.net...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
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,...

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.