I added a Response.Redirect to a .Net Web page and began receiving a "Thread was being aborted" error on a line of code that executed Response.Redirect. Without really considering it, this error made sense based on the place where I added the code.
Response.Redirect will call Response.End by design. However, this will also raise a ThreadAbortException. In my case, it was because the redirect line was within a try...catch block. I found two ways to handle this:
- Change Response.Redirect(<URL>) to Response.Redirect(<URL>, false)
- Move the line to outside the try...catch block
I ended up using method #2, but both options worked for me.