title: Scope of static Variable in multi-user ASP.NET web application
body: <p>Does static variables retain their values across user sessions? </p>
  
  <p>I have a ASP.NET web application where I have two buttons. One for setting the static variable value, another for Showing the static variable value.</p>
  
  <pre><code>namespace WebApplication1
  {   
  
  public partial class WebForm1 : System.Web.UI.Page
  {
      public static int customerID;
  
      protected void Page_Load(object sender, EventArgs e)
      {
  
      }
  
      protected void ButtonSetCustomerID_Click(object sender, EventArgs e)
      {
          customerID = Convert.ToInt32(TextBox1.Text);
      }
  
      protected void ButtonGetCustomerID_Click(object sender, EventArgs e)
      {
          Label1.Text = Convert.ToString(customerID);
      }
  }
  
  }
  </code></pre>
  
  <p>While this works in single-user environment, What happens if there are 2 users simultaneously logged in from two computers, User 1 sets the value as 100, then User 2 sets the value as 200. after that user 1 invokes the Get Value button. What will he see as the value?</p>