Skip to content

RedirectToAction in Core 3.1 MVC route values don't pass through if param has default #22303

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Budsy opened this issue May 27, 2020 · 2 comments
Labels
affected-medium This issue impacts approximately half of our customers area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-routing severity-major This label is used by an internal tool
Milestone

Comments

@Budsy
Copy link

Budsy commented May 27, 2020

This action won't load the parameter with a passed route value from a redirection because it has a default.

public IActionResult HelloWorld(string message="")
{
    ViewData["Message"] = message;  // If sent 'Howdy' from SendMsg() message will be empty 
    return View(); 
}
public IActionResult() SendMsg()
{
    return RedirectToAction("HelloWorld", new{ message="Howdy" });
}
/***********************************************/
// But this works ok if there is no default value on the param:
public IActionResult HelloWorld(string message)
{
    ViewData["Message"] = message;  // message will hold 'Howdy' now
    return View(); 
}

I never observed this before, so it might be a long-standing issues, normal behavior, or whatever.

@scalablecory scalablecory transferred this issue from dotnet/core May 28, 2020
@javiercn javiercn added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label May 28, 2020
@mkArtakMSFT
Copy link
Member

Thanks for contacting us.
You can unblock yourself by not using the default value. We will move this to Backlog and see whether other customers also impacted by this. If yes, we'll prioritize this then.

@mkArtakMSFT mkArtakMSFT added this to the Backlog milestone Jun 3, 2020
@javiercn javiercn added affected-medium This issue impacts approximately half of our customers enhancement This issue represents an ask for new feature or an enhancement to an existing one severity-major This label is used by an internal tool labels Nov 6, 2020 — with ASP.NET Core Issue Ranking
@mkArtakMSFT mkArtakMSFT modified the milestones: Backlog, .NET 8 Planning Oct 12, 2022
@ghost
Copy link

ghost commented Oct 12, 2022

Thanks for contacting us.

We're moving this issue to the .NET 8 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affected-medium This issue impacts approximately half of our customers area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-routing severity-major This label is used by an internal tool
Projects
None yet
Development

No branches or pull requests

8 participants