title: How to POST via a link in ASP.NET Core
body: <p>I try to POST to the SetLanguage action via a link, but not sure how to finalize the following code: </p>
  
  <pre><code>&lt;form id="selectLanguage" asp-controller="Home" asp-action="SetLanguage" asp-route-returnUrl="@Context.Request.Path" method="post" role="form"&gt;
      @foreach (var culture in cultures) {
          &lt;div&gt;                
              &lt;a href="?culture=@culture.Name"&gt;@culture.Name&lt;/a&gt;
          &lt;/div&gt;
      }
   &lt;/form&gt;
  </code></pre>
  
  <p>Should I use the <code>form</code> or there is a direct method to send a POST with <code>culture : 'EN'</code> param, by eg?</p>
  
  <p>Does the <code>@Url.Action(action: "SetLanguage", controller:"Home", values: new { culture = culture.Name }, protocol:"POST")</code> do the work ?</p>
  
  <p>My Controller code is </p>
  
  <pre><code>[HttpPost]
  public IActionResult SetLanguage(string culture, string returnUrl)
  {
      Response.Cookies.Append(
          CookieRequestCultureProvider.DefaultCookieName,
          CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture)),
          new CookieOptions { Expires = DateTimeOffset.UtcNow.AddYears(1) }
      );
  
      return LocalRedirect(returnUrl);
  }
  </code></pre>