title: Keep processing after returning a response to the client
body: <p>I've got a generic handler (.ashx) page that receives an XML document from a lead provider.  I then take that XML document and send it on to a third party for underwriting.  I wait for a response from the 3rd party, then I pass that response along to the lead provider.  All of this happens in 30 seconds or less.</p>
  
  <p>My problem is that the lead provider will only wait for a maximum of 30 seconds before closing the connection and moving on.  I am trying to start an internal timer, and if I haven't heard back from the 3rd party underwriter, send a response to the lead provider anyway.  This all works fine.</p>
  
  <p>What I want to do is to send the response back to the lead provider, but continue waiting for the 3rd party underwriter's response.  They will get it to us...but it might take a couple minutes sometimes.</p>
  
  <p>I've tried all sorts of combinations of </p>
  
  <pre><code>Response.Flush();
  Response.Close();
  Response.End();
  context.ApplicationInstance.CompleteRequest();
  </code></pre>
  
  <p>All I've gotten that to do is to a) throw an error about thread being aborted, or "Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.", or b) the client thinks that the request was just terminated and it never received the response.</p>
  
  <p>I can't implement a queue type architecture without reworking much of the logic, and even then I don't want to do that because it would increase the processing time of the response.</p>
  
  <p>Any suggestions?  It appears that .Close() and .End() are not meant to function how I think they are, and I can't figure out what should be used instead.</p>