Prevent Thread Exceptions in ASP.NET

In ASP.NET, if you see Exception messages like this:

Thread was being aborted.

Coming from:

System.Web.HttpResponse.Redirect

This is due to the default behavior of the Redirect call and it always throws this exception that is usually absorbed by ASP.NET. You might see this if you are using Exception logging in your application.

So make sure when you call Response.Redirect you use the following syntax:

Response.Redirect("nextpage.aspx", false);

This will prevent Exceptions being thrown.

Tip By: David McCarter


Discover more from dotNetTips.com

Subscribe to get the latest posts sent to your email.

One thought on “Prevent Thread Exceptions in ASP.NET

Leave a reply to Craig H Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.