Thread was being aborted, Response.Redirect

Sometimes, trying to handle exceptions with a statement that redirects the page, we may get a ThreadAbortException error.

“If you use the Response.End, Response.Redirect, or Server.Transfer method, a ThreadAbortException exception occurs. You can use a try-catch statement to catch this exception.”

The solution is using these two lines:


Response.Redirect(url,false);
Context.ApplicationInstance.CompleteRequest();

Oficilal solution page from Microsoft:

https://support.microsoft.com/en-us/kb/312629

Advertisements
This entry was posted in C#. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s