title: Aborting a thread in ASP.NET
body: <pre><code>protected System.Threading.Thread m_searchthread = null;
  </code></pre>
  
  <p>Question: I've implemented a search algorithm, which a user can start from an ASP.NET website.</p>
  
  <p>When the user clicks on Button "Start", this code is executed:</p>
  
  <pre><code>m_searchthread = new System.Threading.Thread(new System.Threading.ThreadStart(Search));
  m_searchthread.IsBackground = true;
  m_searchthread.Start();
  </code></pre>
  
  <p>Now I want to make it possible to abort the search thread.
  So the user presses on Button "Abort", and this code is executed:</p>
  
  <pre><code>m_searchthread.Abort();
  </code></pre>
  
  <p>My problem now is: the postback of the abort button resets m_searchthread to NULL...</p>
  
  <p><em>I am aware of the fact that the thread should be aborted using a flag.</em> The core problem is just: how to stop a thread when you loose all the variables ? </p>