Response.Redirect() without generating System.Threading.Threadabortexception?

Asked

Viewed 336 times

2

At every point in the system it has a Response.Redirect("/Url.aspx");

Generates the type Exception System.Threading.ThreadAbortException, but it works.

There is some way to do Response.Redirect, without generating Exception?

1 answer

2


This is a problem specific to Webforms and does not occur in ASP.NET MVC, so I added the correct tag to the question.

Translated from here:

The default is to call Overload Redirect with the parameter endResponse=false and tell IIS to complete the request immediately once the method is finished.

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

Este blog post Thomas Marquardt explains this problem and also how to make a redirect inside a Handler Application_Error.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.