none
Call a POST method in @Html.ActionLink or @Url.Action RRS feed

  • Question

  • Hi everybody,

    I'm developing a web app using ASP.NET MVC. I have a controller that contains some methods. For example I have these two methods:

     [HttpPost]
            public ActionResult SelectResult(int idResult)
            {

              ...

              return RedirectToAction("Result");

    }

    and

    [HttpGet]
            public ActionResult Result()
            {

             ....

             return View();

            }

    So, in a view Example.cshtml I have a table with some values and if the user click on one of these values, he is redirected to Result.cshtml. But I don't want to put the HTTP GET Result(), but the HTTP POST SelectResult(int idResult) to avoid to show in the Web App URL the ...\Home\Result?id=2 (for example). How can I call the HTTP POST the the @Html.ActionLink or @Url.Action in the Example.cshtml <td> </td>?

    Wednesday, October 16, 2019 9:25 AM

All replies