AspNet.Mvc.TypedRouting icon indicating copy to clipboard operation
AspNet.Mvc.TypedRouting copied to clipboard

RedirectToAction on another controller clears action parameters

Open viktorsykora opened this issue 5 years ago • 3 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

viktorsykora avatar Jul 04 '19 12:07 viktorsykora

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

ivaylokenov avatar Jul 07 '19 10:07 ivaylokenov

It's ASP.NET Core 2.1.1.

viktorsykora avatar Jul 07 '19 16:07 viktorsykora

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!

ivaylokenov avatar Sep 10 '19 13:09 ivaylokenov