dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.39k stars 10k forks source link

Anchor tag helper should allow for multiple route value parameters with the same name #40556

Open nfplee opened 2 years ago

nfplee commented 2 years ago

The route values property in the anthor tag helper only allows for route values to have a single value since it of type IDictionary<string, string>. Therefore when you say:

<a asp-action="Index" asp-all-route-data="@Context.Request.Query.ToDictionary(kvp => kvp.Key, kvp => (string)kvp.Value)">Link 1</a>

If the query string is ?filter=Red&filter=Green it produces:

<a href="/shop?filter=Red,Green">Link 1</a>

However if you say:

<a href="@Url.Action("Index", Context.Request.Query.ToDictionary(kvp => kvp.Key, kvp => (object?)kvp.Value))">Link 1</a>

It correctly produces:

<a href="/shop?filter=Red&amp;filter=Green">Link 1</a>
ghost commented 2 years ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.