title: if(!IsPostback) doesn't exist in the current context
body: <p>I'm building a web application using a webform and I'm trying to store a counter in a Session, but I'm getting the error that   if(!IsPostback) doesn't exist in the current context. Can anyone help me with this issue?</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
          if(!IsPostback)
  {
  Session["AttemptCount"] = 0;
  }
  
  }
  
    protected void submitAnswerButton_Click(object sender, EventArgs e)
      {
  
  
  
          //difficultyList.SelectedIndex = 2;
          answerStatus.Visible = true;
  
  
          int answer = randomNumber1 + randomNumber2;
          int counter = (int)Session["AttemptCount"];
          if (mathAnswerTextBox.Text == answer.ToString())
          {
    counter++;
              Session["AttemptCount"] = counter;
  
              answerStatus.Text = "Correct!";
  
  
             // scoreLabel.Text = "Score: " + counter.ToString();
              randomNumber1 = random.Next(0, 50);
              randomNumber2 = random.Next(0, 50);
              num1Label.Text = Convert.ToString(randomNumber1);//add this line 
              num2Label.Text = Convert.ToString(randomNumber2); //and this line
              num1Label.Visible = true;
              num2Label.Visible = true;
              mathAnswerTextBox.Visible = true;
  
              submitAnswerButton.Visible = true;
          }
          else if (mathAnswerTextBox.Text != answer.ToString())
          {
  
              answerStatus.Text = "Incorrect";
  
              incorrectStrikes.Text = counter.ToString();
              num1Label.Visible = true;
              num2Label.Visible = true;
              mathAnswerTextBox.Visible = true;
              submitAnswerButton.Visible = true;
          //    scoreLabel.Text = counterArray[0].ToString();
  
          }
  </code></pre>