title: Save data through session in C# web application
body: <p>I try to create a web application that got a button that change an image. this is my code:</p>
  
  <pre><code>public partial class _Default : System.Web.UI.Page
  {
      private bool test ;
      protected void Page_Load(object sender, EventArgs e)
      {
  
      }
  
      protected void Button1_Click(object sender, EventArgs e)
      {
  
          if (test)
          {
              Image1.ImageUrl = @"~/images/il_570xN.183385863.jpg";
              test = false;
          }else
          {
              Image1.ImageUrl = @"~/images/BAG.png";
              test = true;
          }
  
      }
  }
  </code></pre>
  
  <p>my problem is that the page reload every time. meaning, after i click the button "test" return to it's initial value. how can i have a variable that i can access all through the session? <br>
  please notice, i don't want to solve this specific image problem, but to know how to keep data until the user closed the page.</p>