title: Asp .net session variables update by thread is not getting reflected in Session
body: <p>In my page1.aspx i am generating a report from database by using thread.</p>
  
  <pre><code>//on button click
  Hashtable ht = (Hashtable)Session["ReportParam"];
  ReportThreadClass rth = new ReportThreadClass(ht);
  Thread thread = new System.Threading.ThreadStart(rth .Run);
  thread.Start();
  </code></pre>
  
  <p>In my thread class's rum method i am updating values in Hashtable that how many pages i have created.</p>
  
  <pre><code>//in thread' method        
  public virtual void Run()
  {      
      int pagecount=0;
      while(done)
      {
          //loading data from DB and generating html pages
  
          ht["Total_Pages"] = pagecount;
      }
  }
  </code></pre>
  
  <p>At my Page2.aspx i am reading values from Session Variable</p>
  
  <pre><code>Hashtable ht = (Hashtable)Session["ReportParam"];
  int TotalPages = (int) ht["Total_Pages"];
  </code></pre>
  
  <p>When i run above code in InProc mode every thing is working fine i am getting updated values from session.
  Because every thing is stored in static variable, and ht is referenced by Session so it automatically get updated in session (HashTable not needed to reassign it to session back).</p>
  
  <p>But when i run code in State server (OutProc mode) It need to store session data in different process by Serializing Hash-table.</p>
  
  <p>But the value of Total_Pages is not getting updated in Page2.aspx even after Thread run completely.</p>
  
  <p>So is there any event or method which get fired to store all updates in session variable to State-Server , if yes then pls tell me . if not then pls suggest me some idea to get updated value in page2.aspx.</p>