Skip to content

Other coding suggestions

mikepetersonccv edited this page Oct 12, 2012 · 2 revisions

Response.Redirect(url, [true]) quietly throws ThreadAbortExceptions

  • Whenever Response.Redirect(url) or Response.Redirect(url, true) is called, it quietly throws a ThreadAbortException. This is supposedly by design, but mostly for backwords compatibility with older versions of ASP.NET. If you've ever looked in your output window when debugging, you might notice a whole bunch of ThreadAbortExceptions. These are most likely due to using Response.Redirect(url, [true]). These ThreadAbortExceptions are ignored by the debugger by default, but they can be little annoying and there is a little bit of performance hit due to them. Here is how how Redirects should be written:
Clone this wiki locally