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

Advertisements

One thought on “Prevent Thread Exceptions in ASP.NET

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