title: Saving object reference of class in Session or declare as static?
body: <p>Let´s say I have a class like this:</p>
  
  <pre><code>class Test{
  
     private string status;
  
     public Test(){
  
        //Do some processing. After processing is done assign
  
      status = "processdone_uniqueidhere";
  
        }    
  }
  </code></pre>
  
  <p>Now, in my asp.net application I need to periodically check status using a timer for a value when the processing is done.</p>
  
  <p>Basically, I can store the reference of the class "Test" in session such as:</p>
  
  <pre><code>Test t = new Test();
  Session["uniquesession"] = (Test)t;
  </code></pre>
  
  <p>This was, in the timer, I can retrieve the instance of the class from the session and check for the value of status:</p>
  
  <pre><code>Test t = (Test)Session["uniquesession"];
  
  string value = t.status;
  </code></pre>
  
  <p>I´m not able to store the reference in a ViewState even if I declare the class as [Serializable]. Not sure why. Works with session though.</p>
  
  <p>The other method is to declare the class as static and declare the variable status as static and public and check the value like this:</p>
  
  <pre><code>string value = Test.status;
  </code></pre>
  
  <p>Which way is most stable and which way is bad practice?</p>