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

2

At all points in the system that has a Response.Redirect("/Url.aspx");

It generates the exception of type System.Threading.ThreadAbortException , but it works.

Is there a way to do Response.Redirect, without generating the exception?

    
asked by anonymous 07.08.2015 / 20:35

1 answer

2

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

Translated from here :

The default is to call the Redirect overload with the endResponse=false parameter and tell IIS to complete the request immediately as soon as the method finishes.

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

This post blog by Thomas Marquardt explains this problem and also how to do a redirect within a Application_Error handler.

    
07.08.2015 / 21:56