title: Session variables set - Page_Load method C#
body: <p>I tried to link default1.aspx and default 2.aspx.</p>
  
  <p>What I'm trying to do is to display calculated results in default1.aspx when clicking confirm button in default2.aspx.</p>
  
  <p>I run the codes but it doesn't work really.
  How can I fix this?</p>
  
  <p>I wrote the codes in default1.aspx below:</p>
  
  <pre><code>protected void confirmBookingButton_Click(object sender, ImageClickEventArgs e)
  {
      Response.Redirect("RoomBookingMain.aspx");
      Session["confirmBooking"] = "confirm";
      Session["totalBooking"] = calculateTextBox.Text;
  }
  </code></pre>
  
  <p>and then I wrote other codes in default2.aspx like:</p>
  
  <pre><code>public partial class RoomBookingMain : System.Web.UI.Page
  {
  static int nbBookingInt = 0;
  static int totalRevenueInt = 0;
  }
  
  
  protected void Page_Load(object sender, EventArgs e)
  {
      bookingNbLabel.Text = nbBookingInt.ToString();
      totRevenueLabel.Text = totalRevenueInt.ToString();
      string confirmBooking = (string)(Session["confirmBooking"]);
      if ((string)(Session["confirmBooking"]) == "confirm")
      {
          nbBookingInt += 1;
          totalRevenueInt += int.Parse(Session["totalBooking"].ToString());
          Session["confirmBooking"] = "no current booking";
      }
  }
  </code></pre>