ivaylokenov / AspNet.Mvc.TypedRouting

A collection of extension methods providing strongly typed routing and link generation for ASP.NET Core MVC projects.

Home Page:https://mytestedasp.net/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RedirectToAction on another controller clears action parameters

viktorsykora opened this issue · comments

Hi,

Just found a possible issue when calling RedirectToAction with target action on another controller.

Here is the code:

public class HomeController : Controller
{
    public IActionResult Index()
    {
        return this.RedirectToAction<TestController>(c => c.Test(9));
    }
}
public class TestController : Controller
{
    public IActionResult Test(long id)
    {
        return View();
    }
}

The id parameter in Test action should be 9, but it's defaulted to 0. When I move the Test action into HomeController then it starts to work just fine.

Any suggestions appreciated,
Thanks

Hi @viktorsykora! Which version of ASP.NET Core are you using?

It's ASP.NET Core 2.1.1.

Hi, thank you for your issue. Since I am overwhelmed with my other project https://github.com/ivaylokenov/MyTested.AspNetCore.Mvc, I did not have a lot of time to support this one. Will try to publish a new package during the weekend. Thank you for your patience!