Response.redirect raises "Thread was being aborted"
By default, Response.Redirect()
aborts the current thread. Naturally, this throws a ThreadAbortException
. It can be prevented by passing a false
to Response.Redirect()
, which won't abort the current thread.
Be aware of what that means, however. If the thread is not aborted, the code following the Response.Redirect()
will continue to execute. Control your logic flow accordingly. (This is often done with return
statements and other flow control directives following a redirect.)
Response.Redirect
will always throw a ThreadAbortException
, according to MSDN documentation if you don't give a false
boolean value to endResponse
input parameter HttpRequest.Redirect(string, bool)
.
Just give false
to endResponse
parameter.