Index.cshtml(7,16): error CS0103: The name 'Request' does not exist in the current context
<p>I am working on learning ASP .NET MVC using the dot net core framework. I have reached the point where I am trying to implement a <code>cshtml</code> file using some razor code. But I am getting a error when making the request. </p>

<blockquote>
  <p>Microsoft.AspNetCore.Mvc.Razor.Compilation.CompilationFailedException:
  One or more compilation failures occurred:
  /Views/Shared/Index.cshtml(5,4): error CS0103: The name 'IsPost' does
  not exist in the current context /Views/Shared/Index.cshtml(7,16):
  error CS0103: The name 'Request' does not exist in the current context
  /Views/Shared/Index.cshtml(8,16): error CS0103: The name 'Request'
  does not exist in the current context</p>
</blockquote>

<p>My initial thought is that I am missing a reference, but I am not seeing what I would be missing. I have tried removing the razor code and then the page loads correctly. </p>

<p><strong>project.json</strong></p>

<pre><code>    {
  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.0.0",
      "type": "platform"
    },
    "Microsoft.AspNetCore.Diagnostics": "1.0.0",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
    "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
    "Microsoft.Extensions.Configuration.Json": "1.0.0",
    "Microsoft.Extensions.Configuration.CommandLine": "1.0.0",
    "Microsoft.AspNetCore.Mvc": "1.0.0",
    "Microsoft.AspNetCore.Razor.Tools" : "1.0.0-preview2-final"

  },

  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
    "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final"
  },

  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "web.config"
    ]
  },

  "scripts": {
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  },

  "tooling": {
    "defaultNamespace": "MVCWebAPI"
  }
}
</code></pre>

<p><strong>index.cshtml</strong></p>

<pre><code>&lt;!DOCTYPE html&gt;
@{
var totalMessage = "";
if(IsPost)
    {
    var num1 = Request["text1"];
    var num2 = Request["text2"];
    var total = num1.AsInt() + num2.AsInt();
    totalMessage = "Total = " + total;
    }
}

&lt;html&gt;
&lt;body style="background-color: beige; font-family: Verdana, Arial;"&gt;
&lt;form action="" method="post"&gt;
&lt;p&gt;&lt;label for="text1"&gt;First Number:&lt;/label&gt;&lt;br&gt;
&lt;input type="text" name="text1"&gt;&lt;/p&gt;
&lt;p&gt;&lt;label for="text2"&gt;Second Number:&lt;/label&gt;&lt;br&gt;
&lt;input type="text" name="text2"&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type="submit" value=" Add "&gt;&lt;/p&gt;
&lt;/form&gt;
&lt;p&gt;@totalMessage&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>Thanks</p>