title: System.Threading.ThreadAbortException caused by Response.Redirect
body: <p>In my application I am calling a WebMethod from JavaScript, where I am trying to redirect to some page:</p>
  
  <pre><code>[WebMethod]
  public string Logout() {            
      if (User.Identity.IsAuthenticated) {                            
          HttpContext.Current.Response.Redirect("~/Pages/Logout.aspx");               
      }
      return "";
  }
  </code></pre>
  
  <p>The aspx page:</p>
  
  <pre><code>    &lt;input onclick="callLogout();" id="btn" type="button" value="Click Me" /&gt;
  
      &lt;asp:ScriptManager ID="ScriptManager" runat="server"&gt;
          &lt;Services&gt;
              &lt;asp:ServiceReference Path="~/WebServices/EMSWebService.asmx" /&gt;
          &lt;/Services&gt;
      &lt;/asp:ScriptManager&gt;
      &lt;script type="text/javascript"&gt;        
          function callLogout() {
              EMSApplication.Web.WebServices.EMSWebService.Logout(OnComplete, OnError);
          }
  
          function OnComplete(result) {
              alert(result);
          }
  
          function OnError(result) {
              alert(result.get_message());
          }
      &lt;/script&gt;
  </code></pre>
  
  <p>And I am getting:</p>
  
  <blockquote>
    <p>A first chance exception of type
    'System.Threading.ThreadAbortException' occurred in mscorlib.dll </p>
    
    <p>An exception of type 'System.Threading.ThreadAbortException' occurred in
    mscorlib.dll but was not handled in user code</p>
  </blockquote>
  
  <p>in my VS2010's Output window.</p>
  
  <p>Why I am getting this exception and how can I resolve this?</p>