Sometimes, trying to handle exceptions with a statement that redirects the page, we may get a ThreadAbortException error.
“If you use the Response.End, Response.Redirect, or Server.Transfer method, a ThreadAbortException exception occurs. You can use a try-catch statement to catch this exception.”
The solution is using these two lines:
Oficilal solution page from Microsoft: