By design, the Response.Redirect method in ASP.NET will throw a ThreadAbortException when either the default overload is used (Response.Redirect(url)) or a value of ‘true’ is specified in the second overload (Response.Redirect(url, endResponse)). You can read more details here. In order to avoid logging this exception, make sure to not place any Response.Redirect calls in the try portion of a try.. catch block. One thing I did note is that ASP.NET will not catch and log this error if you are using the Page_Error method, but you will catch it if you have it in your own try.. catch code.
Don’t do this:
try
{
// .. code that does something
Response.Redirect("A new page");
}
catch (Exception ex) { /* log error */ }
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.