title: Nested try-catch with Reponse.Redirect in ASP.NET
body: <p>I have nested try catch blocks</p>
  
  <pre><code>try
  {
      // statements
      try
      {
          // statements
      }
      catch(SqlException sqlex)
      {
          Response.Redirect(@"~/Error.aspx?err=" + Server.UrlEncode(sqlex.Message)
                                + "&amp;src=" + Server.UrlEncode(sqlex.ToString()));
      }
      catch (Exception ex)
      {
          Response.Redirect(@"~/Error.aspx?err=" + Server.UrlEncode(ex.Message)
                                + "&amp;src=" + Server.UrlEncode(ex.ToString()));
      }
      finally
      {
          conn.Close();
      }
  }
  catch (Exception ex)
  {
      Response.Redirect(@"~/Error.aspx?err=" + Server.UrlEncode(ex.Message)
                            + "&amp;src=" + Server.UrlEncode(ex.StackTrace)); 
  }
  finally
  {
      conn.Close();
  }
  </code></pre>
  
  <p>If a SqlExeception is caught at inner first catch block, then also because try...catch surrounds <code>Response.Redirect</code>, the ThreadAbortException generated by the transfer is caught by the outer catch block.</p>
  
  <p>How can I solve this problem? Thanks!</p>