Response.Redirect
has two overloads:
public void Redirect(string url) Parameters: url: The target location.
public void Redirect(string url, bool endResponse) Parameters: url: The location of the target. endResponse: Indicates whether execution of the current page should terminate.
If I call the first overload, or call the second with endResponse
set to true
a ThreadAbortException
gets thrown.
Why would I ever want to use this approach? Isn't this an example of using exceptions to handle program flow? (and therefore a bad thing)
And if my redirection did warrant an exeption, wouldn't it be preferable for me to throw a more informative exception that includes the reason for the redirect?