title: The name 'isPost' does not exist in the current context (ASP.NET with Razor)
body: <p>I'm trying to follow the <a href="https://docs.microsoft.com/en-us/aspnet/web-pages/overview/getting-started/introducing-razor-syntax-c#a-simple-code-example" rel="nofollow noreferrer">Microsoft Docs on getting started with Razor</a>. When I try to implement the following code I get the errors detailed in the comments:</p>
  <p><code>Solution/Project/Pages/AddNumbers.cshtml</code> :</p>
  <pre class="lang-cs prettyprint-override"><code>@{
      var total = 0;
      var totalMessage = &quot;&quot;;
      if(IsPost) { // The name 'isPost' does not exist in the current context
  
          // Retrieve the numbers that the user entered.
          var num1 = Request[&quot;text1&quot;]; // CS0103  The name 'Request' does not exist in the current context
          var num2 = Request[&quot;text2&quot;]; // CS0103  The name 'Request' does not exist in the current context
  
          // Convert the entered strings into integers numbers and add.
          total = num1.AsInt() + num2.AsInt();
          totalMessage = &quot;Total = &quot; + total;
      }
  }
  </code></pre>
  <p>I think I've followed the instructions faithfully, but can't think where I've made an error. What's the fix?</p>