title: Asp.Net-Core with Razor Pages web app send values on Post method
body: <p>Is it possible in Asp.Net-Core Webb Application with Razor Pages to send some values via the url and post method? I know that in MVC you would use the HttpPost method, but that is not possible in .Net Core.</p>
  <p>For example, in my js file I have this function that receives a parameter a:</p>
  <pre><code>function redirect(a)
  {
      $.ajax({
        type: 'POST',
        url: './MyPage', //I also tried @Url.Page(&quot;SetValue&quot;)'
        dataType: 'int',
        data: { a },
     });
  }
  </code></pre>
  <p>I want to be able to send that value to my Razor Page, something like this:</p>
  <pre><code>public void OnPostSetValue(int a)
  {         
      Debug.WriteLine(a); //here I will use the value       
  }
  </code></pre>
  <p>But I am getting this error: &quot;Failed to load resource: the server responded with a status of 500 () [https://localhost:44350/MyPage]&quot;</p>
  <p>I know that probably this is not the way to do it, but I only found examples for MVC. Is there any way I can do this here in Asp.Net Core?</p>